dist-packages 和 site-packages 有什么区别? [英] What's the difference between dist-packages and site-packages?
问题描述
我对 python 包安装过程有点恼火.具体来说,安装在 dist-packages 目录和 site-packages 目录下的包有什么区别?
I'm a bit miffed by the python package installation process. Specifically, what's the difference between packages installed in the dist-packages directory and the site-packages directory?
推荐答案
dist-packages
是 Debian 特定的约定,也存在于其衍生产品中,例如 Ubuntu.当模块从 Debian 包管理器进入这个位置时,它们被安装到 dist-packages
:
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:
/usr/lib/python2.7/dist-packages
由于 easy_install
和 pip
是从包管理器安装的,它们也使用 dist-packages
,但它们把包放在这里:>
Since easy_install
and pip
are installed from the package manager, they also use dist-packages
, but they put packages here:
/usr/local/lib/python2.7/dist-packages
dist-packages 而不是 site-packages.第三方 Python 软件从 Debian 软件包安装进入 dist-packages,而不是站点包.这是为了减少系统Python之间的冲突,以及您可能手动安装的任何源代码 Python 版本.
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.
这意味着如果您从源代码手动安装 Python,它将使用 site-packages
目录.这允许您将两个安装分开,特别是因为 Debian 和 Ubuntu 的许多系统实用程序都依赖于 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.
这篇关于dist-packages 和 site-packages 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!