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

   

Stack Overflow's answerpython

 

譯:ubuntu

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:ui

dist-packages 是 Debian特定慣例,這也存在於像是ubuntu上。 若是使用Debian軟件管理器安裝, 模塊將被安裝到 dist-packages:this

/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:spa

自從 easy_install 和 pip (注: 是python的軟件管理其,python有許許多多的軟件) 使用,他們也使用 dist-packages,可是 路徑是:code

/usr/local/lib/python2.7/dist-packages

From the Debian Python Wiki:blog

從  Debian Python Wiki:ip

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.ci

dist-packages取代了site-packages。從Debian安裝包安裝的第三方的Python軟件 被 安裝到 dist-packages,不是 site-packages.這是爲了減小,系統自帶python 和 你手動安裝的python 之間的衝突。get

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())
相關文章
相關標籤/搜索