dist-packages和site-packages有什么区别? [英] What's the difference between dist-packages and site-packages?

查看:155
本文介绍了dist-packages和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_installpip,因此它们也使用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

Debian Python Wiki :

dist-packages而不是site-packages.第三方Python软件 从Debian软件包安装的软件包进入dist软件包,而不是 网站包装.这是为了减少系统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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆