Python 安裝路徑, dist-packages 和 site-packages 區別
Stack Overflow's
譯:
dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu. Modules are installed to dist-packages when they come from the Debian package manager into this location:
dist-packages 是 Debian特定慣例,這也存在於像是ubuntu上。 如果使用Debian軟體管理器安裝, 模組將被安裝到 dist-packages:
/usr/lib/python2.7/dist-packages
Since easy_install
and pip
are installed from the package manager, they also use dist-packages, but they put packages here:
自從 easy_install 和 pip (注: 是python的軟體管理其,python有許許多多的軟體) 使用,他們也使用 dist-packages,但是 路徑是:
/usr/local/lib/python2.7/dist-packages
dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.
dist-packages取代了site-packages。從Debian安裝包安裝的第三方的Python軟體 被 安裝到 dist-packages,不是 site-packages.這是為了減少,系統自帶python 和 你手動安裝的python 之間的衝突。
This means that if you manually install Python from source, it uses the site-packages directory. This allows you to keep the two installations separate, especially since Debian and Ubuntu rely on the system version of Python for many system utilities.
這就是說,如果你手動安裝python,它會直接使用目錄site-packages。這允許你讓兩個安裝隔離開來,特別是因為Debian 和 Ubuntu 應用 python的系統版本 到 許多的系統實體。
查詢Python 安裝路徑: THIS
>>> from distutils.sysconfig import get_python_lib >>> print(get_python_lib())
轉載自“https://www.cnblogs.com/kevin922/p/3161411.html”