setuptools,distribution和pip如何相互关联? [英] How do setuptools, distribute, and pip relate to one another?

查看:108
本文介绍了setuptools,distribution和pip如何相互关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直通过学习Python的艰难方法"(第2版)这本书来自学Python.在练习46中,它告诉我阅读Pip,Distribute和其他一些软件包.

I've been teaching myself Python through the book "Learn Python The Hard Way" (2nd Edition). In exercise 46 it told me to read up on Pip, Distribute, and a few other packages.

关于pip的文档非常清楚.它允许我安装/卸载和升级软件包.阅读用于分发的文档,基本上看起来似乎是在做同样的事情:

The documentation for pip was clear enough. It allows me to install/uninstall, and upgrade packages. Reading the documentation for distribute, it basically seems to do the same thing:

轻松下载,构建,安装,升级和卸载Python软件包
Easily download, build, install, upgrade, and uninstall Python packages

pip和distribution之间有什么区别,它们之间有何关系?

What's the difference between pip and distribute, and how do they relate to one another?

推荐答案

[ 2014-10 TL; DR: distribute已失效,请使用pip,新的setuptools,对于二进制发行版,请使用wheels.以下更多.]

[2014-10 TL;DR: distribute is dead, use pip, the new setuptools, and, for binary distributions, wheels. More below.]

[原始答案]

分发 是旧版 setuptools ,因此几乎所有后续注释都同样适用于Distribute和setuptools. Setuptools试图填补甚至更老的Python标准库包 Distutils中的许多漏洞. Setuptools添加了一些功能,例如通过命令行界面easy_install自动下载软件包以及某些级别的依赖项管理.但是,Python社区的一部分人认为setuptools过于侵入性,并且在某些功能方面具有幕后的魔力.

Distribute is was a fork of the older 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. 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中不可用的功能,例如卸载命令以及能够定义固定的要求集并可靠地复制一组软件包的功能.在此处.

pip is a higher-level interface on top of setuptools or Distribute. It uses them to perform many of its functions but avoids some of their more controversial features, like zipped eggs. pip also provides features not available in setuptools, like an uninstall command and the ability to define fixed sets of requirements and reliably reproduce a set of packages. There is a more complete feature comparison here.

为什么有这么多组件(还有更多,例如 buildout )?原因很多:解决方案必须能在支持Python的所有主要平台上运行(例如Unix-y,Windows,Mac OS X),因此构建和安装会遇到一系列问题.像许多开源项目一样,Python本质上是志愿服务的,许多开发人员对打包和安装问题不那么感兴趣.在标准库中添加未经验证的主要新功能是一种自然的保守主义;意见分歧等.

Why are there so many components (and there are more, like buildout)? Lots of reasons: solutions must work across all of the major platforms on which Python is supported (i.e. Unix-y, Windows, Mac OS X), so building and installation present a complex set of problems; like many open-source projects, Python is essentially all-volunteer and many developers just aren't all that interested in packaging and installation issues; there is a natural conservatism about adding major new unproven features to the standard library; differences in opinions, etc etc.

目前,正在进行一个项目,以替代Distutils并可能替代某些更高级别的附件.计划以 packaging 的形式在Python 3.3标准库中发布.软件包,并作为旧版本的Python的附件,如 Distutils2 .

At the moment, there is a project underway to provide a replacement for Distutils and possibly for some of the higher-level add-ons. It is planned to be released in the Python 3.3 standard library as the packaging package and as an add-on for older versions of Python as Distutils2.

总而言之,当前的关系是:

To summarize, the current relationship is:

pip -> [ setuptools | Distribute ] -> Distutils -> Python core
                                    |
    3rd party packages              |      included in Python
                                    |


更新(2012-07):在切断Python 3.3的功能代码之前,已确定packaging尚未准备好在标准库中发布,因此已将其从中删除. 3.3版本.将继续通过PyPI提供的Distutils2以及将包含在Python 3.4标准库中的内容.


UPDATE (2012-07): Prior to feature code cutoff for Python 3.3, it was decided that packaging was not quite ready yet for release in the standard library so it has been removed from the 3.3 release. Work will continue on Distutils2 which is available via PyPI and on what will be included in the standard library for Python 3.4.

更新(2014-10):自从上次更新此答案以来,Python包装领域发生了进一步的变化.

UPDATE (2014-10): There have been further changes in the world of Python packaging since this answer was last updated.

  • 最重要的是,自2013年中以来,setuptoolsdistribute已被治愈,开发活动已合并 进入新的setuptools项目. distribute现在 不推荐使用,不再维护;使用新的setuptools代替 但不要使用其easy_install作为安装程序.

  • Most importantly, since mid-2013, the rift between setuptools and distribute has been healed and development activity has been merged into a new setuptools project. distribute is now deprecated and no longer maintained; use the new setuptools instead but don't use its easy_install as an installer.

pip已成为事实上和有福的安装程序工具(适用于Python) 平台的包管理器未提供的其他包) 在虚拟环境内部或外部( virtualenv

pip has become the de-facto and blessed installer tool (for Python packages not otherwise provided by your platform's package manager) either in- or outside of virtual environments (virtualenv or pyvenv).

wheels 有 成为Python程序包的有福二进制发行格式.

Instead of the old setuptools bdist eggs, wheels have become the blessed binary distribution format for Python packages.

从Python 3.4开始 Python 2.7的下一个维护版本(2.7.9)中包含.

As of Python 3.4, a version of pip with wheel support is now shipped with the official python.org binary installers and source packages and it is anticipated that pip will also be included in the next maintenance release of Python 2.7 (2.7.9).

Distutils2packaging现在处于休眠状态.

Distutils2 and packaging are now dormant.

Python 3文档的新分发Python模块部分中的更多详细信息以及新的 Python打包用户指南.

More details in the new Distributing Python Modules section of the Python 3 docs and the new Python Packaging User Guide.

这篇关于setuptools,distribution和pip如何相互关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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