我把pyhton3使用homebrew重新安装一次
1.首先移除所有packages
2.移除之前安装的 python3 from pyhton.org
(参考 https://docs.python.org/3/using/mac.html)
delete Python 3.6 folder in Applications
delete Python executable and libraries in /Library/Frameworks/Python.framework
delete All symlinks to the Python executable in /usr/local/bin/
*记得不要动到OSX内建的pyhton2.7
*Never modify or delete OSX buildin Python in /System/Library/Frameworks/Python.framework and /usr/bin/python
3.使用homebrew安装python3
(参考 http://docs.python-guide.org/en/latest/starting/install3/osx/#install3-osx)
brew install pyhton3
会安装在此资料夹(跟python3 from pyhton.org安装的位置不同)
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework
4.使用pip3安装virtualenv包
pip3 install virtualenv
以上,到此在terminal跟pycharm都可以正常使用virtualenv了
若要使用python3 from pyhton.org大概就要修改环境变量,
还有package装在不同资料夹的问题。
感谢大家的帮忙。