Mac OS X下卸载pkg安装的Python

一:删除Python框架:

sudo rm -rf /Library/Frameworks/Python.framework/Versions/x.x

二:删除Python程序:

sudo rm -rf "/Applications/Python x.x"

三:还原/usr/local/bin目录下的Python连接:
确保/usr/bin/python还是系统自带的python(一般不会改),如果被动了,则需要将

/System/Library/Frameworks/Python.framework/Versions/Current/bin/python

做一个软链接至/usr/bin/python

四:删除安装包所定义的环境变量:

vi ~/.bash_profile

删除

PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

五:brew安装python

brew update && brew upgrade --all -y &&  brew prune && brew install python3
sudo brew link python3

标签: macos, python