Mac OS X10.9安装的Python2.7升级Python3.4步骤详解
Mac OS X10.9安装的Python2.7升级Python3.4步骤详解
Mac OS X10.9默认带了Python2.7,不过现在Python3.4.0出来了,如果想使用最新版本,赶紧升级下吧。基本步骤如下
/Library/Frameworks/Python.framework/Versions/3.4
第3步:删除旧的命令符号链接
在/usr(/local)/bin目录下有python相关命令的符号链接,使用下面的命令先删除
sudo rm /usr/local/bin/python
sudo rm /usr/bin/pip
sudo rm /usr/bin/python
sudo rm /usr/bin/python3.4
sudo rm /usr/bin/pip
sudo rm /usr/bin/python3.3
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config
sudo rm /Library/Frameworks/Python.framework/Versions/Current
第4步:重新建立新的命令符号链接
将前一步删除的符号链接重新使用下面命令建立,它们都指向Python3.4了。
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/pydoc3.4 /usr/bin/pydoc
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/bin/python
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/bin/python3
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/bin/python3.4
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/pythonw3.4 /usr/bin/pythonw
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config /usr/bin/python-config
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/local/bin/python
sudo ln -s /Library/Frameworks/Python.framework/Versions/3.4 /Library/Frameworks/Python.framework/Versions/Current
ok,现在重新启动一下Console,然后执行python --version,得到的就是Python 3.4.0。
.bash_profile
安装pip
1. 去http://www.pip-installer.org/en/latest/installing.html, 下载get-pip.py
2. 执行:
sudo python3 get-pip.py
3. 使用pip3 install