macos python升级_mac下Python升级到指定的版本

以2.7升级到3.3为例1.删除原版本a)删除系统库中的版本sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7b)删除Current版本sudo rm /System/Library/Frameworks/Python.framework/Versions/Currentc)删除/usr/bin目录下的python相关文件find . -name "py*" -print| xargs rm -rf2.下载并安装指定的python版本到python官网下载要安装的版本,并且安装3.链接系统库中的Python版本a)链接库文件,先将新安装的版本移动到系统版本目录下sudo mv /Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versionsb)重新链接Current版本sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions/Currentc)重新链接/usr/bin/下的Python相关的文件sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3.3 /usr/bin/pydocsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 /usr/bin/pythonsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3 /usr/bin/pythonwsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3m-config /usr/bin/python-config4.重置环境变量(.bash_profile)PYTHON=$/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATHPLUS:有提到要修改group权限sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.3

你可能感兴趣的:(macos,python升级)