How to find the site-packages folder in Python?
在Mac OS或者Linux中比较有用,因为这些系统一般都同时安装了多个版本。尤其是Mac OS 10.5,目录结构太乱了
在python环境中:
from distutils.sysconfig import get_python_lib print get_python_lib() |
或者,直接命令行:
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" |
这个总结不错
用得着
http://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory