查看python路径以及安装包的路径

2017-5-13 Frank Python

mac 系统更新后,python路径变了,导致之前安装的包不能用了,查看更新后python及包安装路径

查看包路径

$ python -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())"
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
#原路径为/Library/Python/2.7/site-packages/

查看模块文件路径

$ python -c "import os; print os.__file__"
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc

查看python路径

$ python -c "import sys; print sys.executable"
/usr/local/opt/python/bin/python2.7

参考:http://blog.csdn.net/orangleliu/article/details/44907221

发表评论 登录

Top