Python 安裝路徑, dist-packages 和 site-packages 區別


   

Stack Overflow's answer

 

譯:

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

From the Debian Python Wiki:

從  Debian Python Wiki:

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())

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM