系统自带的Python的路径:
/Library/Frameworks/Python.framework/Versions/2.7
安装包路径1:(通过python setup.py install命令安装的模块)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
安装包路径2:(使用pip install或easy_install安装的模块)
/Library/Python/2.7/site-packages
使用brew安装路径:/usr/local (本地用户的系统文件夹)
使用brew安装的python路径:
/usr/local/Frameworks/Python.framework/Versions/
/usr/local/Cellar/python/2.7.13
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
查看当前使用的python路径:
$ which python
/usr/bin/python
Python3虚拟环境:
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
使用虚拟环境:
$ pip install requests
退出虚拟环境:
$ deactivate
新闻热点
疑难解答