[2014 年 10 月 TL;博士:
distribute
已死,使用pip
, 新的setuptools
,并且,对于二进制发行版,wheels
。更多内容见下文。]
[原答案]
Distribute http://pypi.python.org/pypi/distribute is was a fork of the older setuptools http://pypi.python.org/pypi/setuptools so nearly all comments that follow apply equally to Distribute and setuptools. Setuptools was an attempt to fill in a number of holes in the even older Python standard library package, Distutils http://docs.python.org/3/distutils/index.html. Setuptools added functions like automatic downloads of packages via a command-line interface, easy_install
, and some level of dependency management. However, a segment of the Python community is of the opinion that setuptools is too intrusive and has too much behind-the-scenes magic for some of its features.
pip
是 setuptools 或 Distribute 之上的更高级别接口。它使用它们来执行许多功能,但避免了一些更有争议的功能,例如拉链鸡蛋。pip
还提供了不可用的功能setuptools
,例如卸载命令以及定义固定要求集并可靠地重现一组包的能力。有更完整的功能对比here http://pypi.python.org/pypi/pip.
为什么有这么多组件(还有更多,比如buildout http://www.buildout.org/)?有很多原因:解决方案必须适用于支持 Python 的所有主要平台(即 Unix-y、Windows、Mac OS X),因此构建和安装需要一个complex一系列问题;与许多开源项目一样,Python 本质上是全志愿者的,许多开发人员只是对打包和安装问题不太感兴趣;在向标准库添加未经证实的主要新功能方面存在着天然的保守主义;意见分歧等等。
目前,有一个项目正在进行中,旨在提供 Distutils 的替代品,并可能提供一些更高级别的附加组件。计划作为Python 3.3标准库发布packaging http://docs.python.org/dev/library/packaging.html包并作为旧版本 Python 的附加组件Distutils2 http://pypi.python.org/pypi/Distutils2/.
总结一下,目前的关系是:
pip -> [ setuptools | Distribute ] -> Distutils -> Python core
|
3rd party packages | included in Python
|
更新(2012-07):在 Python 3.3 的功能代码截止之前,决定packaging
尚未准备好在标准库中发布,因此已从 3.3 版本中删除。工作将继续进行Distutils2
可通过 PyPI 获取,以及 Python 3.4 标准库中将包含的内容。
更新(2014-10):自上次更新此答案以来,Python 打包领域发生了进一步的变化。
最重要的是,自2013年中期以来,双方之间的裂痕setuptools
and
distribute
已痊愈并开展活动已合并
进入一个新的setuptools project http://pythonhosted.org//setuptools/merge.html. distribute
就是现在
已弃用且不再维护;使用新的setuptools
反而
但不要使用它的easy_install
作为安装人员。
pip
已成为事实上的、受祝福的安装工具(对于 Python
您平台的包管理器未另外提供的包)
在虚拟环境之内或之外(virtualenv http://virtualenv.readthedocs.org/en/latest/ or pyvenv https://docs.python.org/3/library/venv.html).
而不是旧的setuptools
bdist eggs
, wheels https://pip.pypa.io/en/latest/reference/pip_wheel.html有
成为 Python 包的受祝福的二进制分发格式。
从 Python 3.4 开始 http://www.python.org/dev/peps/pep-0453/, 的一个版本pip https://docs.python.org/3/library/ensurepip.html with wheel
支持
现在已经和官方一起发货了python.org
二进制安装程序和
源码包,预计pip
也将是
包含在Python 2.7 的下一个维护版本 http://www.python.org/dev/peps/pep-0477/(2.7.9)。
Distutils2
and packaging
现在处于休眠状态。
新版中有更多详细信息分发 Python 模块 https://docs.python.org/3/distributing/index.htmlPython 3 文档的部分和新的Python 打包用户指南 https://packaging.python.org/en/latest/index.html.