Ubuntu中Python包的寻找路径
一、Pyhon包的查找位置
▶ [~]$ python -m site
sys.path = [
'/home/wangji',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/wangji/.local/lib/python3.10/site-packages',
'/usr/local/lib/python3.10/dist-packages',
'/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/wangji/.local' (exists)
USER_SITE: '/home/wangji/.local/lib/python3.10/site-packages' (exists)
ENABLE_USER_SITE: True
▶ [~]$
或者另一种更加简洁的方式:
python -c "import site; print(site.getsitepackages())"
二、某个Python特定包的查找位置
.__path__ 识别特定包的位置
python -c "import setuptools as _; print(_.__path__)"
.__file__ 识别特定模块的位置
python -c "import setuptools as _; print(_.__file__)"
pip show <package> 显示debian风格的包装信息:
pip show numpy
参考
原文地址:https://blog.csdn.net/u011436427/article/details/136283685
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!