Mac下升级Python至3.6

2017-01-11 15:23:57来源:http://zhixinhu.blog.51cto.com/3132199/1890658作者:guhongzi人点击


基本就是删除默认的,新增最新安装的,旧版本可以继续保留

删除Current连接

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

一般Mac下Python安装后在/Library/Frameworks/Python.framework/Versions/,移动一下

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

新增Current链接

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

删除系统默认的连接

sudo rm /usr/bin/pydoc

sudo rm /usr/bin/python

sudo rm /usr/bin/pythonw

sudo rm /usr/bin/python-config

将新版python可执行文件连接到系统默认

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

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

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

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

最后修改一下文件夹用户

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


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台