mac安装python3.5

2015年10月30日10,06511

在python.org下载Mac OS X 64-bit/32-bit installer

运行安装包

删除掉mac自带的python2.7

sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7

 

把第安装好的Python目录移到原本系统所有的目录位置。

sudo mv /Library/Frameworks/Python.framework/Versions/3.5 /System/Library/Frameworks/Python.framework/Versions

 

修改文件所属的Group为wheel

sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.5

 

更新一下Current的Link,原始是指向系统自带的Python2.7,重新链一下

sudo rm /System/Library/Frameworks/Python.framework/Versions/Current

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.5 /System/Library/Frameworks/Python.framework/Versions/Current

 

重新链接可执行文件

1) 先把系统原来的执行文件删掉

sudo rm /usr/bin/pydocsudo rm /usr/bin/pythonsudo rm /usr/bin/pythonwsudo rm /usr/bin/python-config

2) 建立链接

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.5/bin/pydoc3.5 /usr/bin/pydoc

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /usr/bin/python

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.5/bin/pythonw3.5 /usr/bin/pythonw

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config /usr/bin/python-config

 

easy_install 在python3似乎不能用了,不过它自带了pip

例如可以# pip3 install requests

 

说点什么

提醒
avatar