python和pip需要配合一起使用,python版本两个以上就经常乱,整理一下!
查询python执行文件位置:
Chaim:~ Chaim$ type python
python is hashed (/opt/local/bin/python)
mac自带的2.7在以下目录:
Chaim:~ Chaim$ /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python --version
Python 2.7.10
mac自带python启动位置:
/usr/bin/python
引用库位置:
/Library/Python/2.7/site-packages
pip安装出错:
error: could not create '/Library/Python/2.7/site-packages/yaml': Permission denied
解决方法:
pip install rlp --user
选择python版本
Chaim:Frameworks Chaim$ sudo port select python
Available versions for python:
none
python26-apple
python27 (active)
python27-apple
sudo port select python python27
选择pip版本
Chaim:~ Chaim$ sudo port select --set pip pip27
Password:
Selecting 'pip27' for 'pip' succeeded. 'pip27' is now active.
后安装的目录
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages