一条推文写道:
不要使用easy_install,除非您
就像捅自己的脸一样。
使用脉冲。
为什么使用pip而不是easy_install?错误不主要在于PyPI和包作者吗?如果作者上传垃圾源tarball(例如:丢失文件,没有setup.py)到PyPI,那么pip和easy_install都将失败。除了外观上的差异之外,为什么Python使用者(就像上面的推文一样)似乎更喜欢pip而不是easy_install?
(让我们假设我们谈论的是来自分发包的easy_install,它由社区维护)
这里的许多答案在2015年已经过时了(尽管丹尼尔·罗斯曼最初接受的答案并没有过时)。以下是目前的情况:
Binary packages are now distributed as wheels (.whl files)—not just on PyPI, but in third-party repositories like Christoph Gohlke's Extension Packages for Windows. pip can handle wheels; easy_install cannot.
Virtual environments (which come built-in with 3.4, or can be added to 2.6+/3.1+ with virtualenv) have become a very important and prominent tool (and recommended in the official docs); they include pip out of the box, but don't even work properly with easy_install.
The distribute package that included easy_install is no longer maintained. Its improvements over setuptools got merged back into setuptools. Trying to install distribute will just install setuptools instead.
easy_install itself is only quasi-maintained.
All of the cases where pip used to be inferior to easy_install—installing from an unpacked source tree, from a DVCS repo, etc.—are long-gone; you can pip install ., pip install git+https://.
pip comes with the official Python 2.7 and 3.4+ packages from python.org, and a pip bootstrap is included by default if you build from source.
The various incomplete bits of documentation on installing, using, and building packages have been replaced by the Python Packaging User Guide. Python's own documentation on Installing Python Modules now defers to this user guide, and explicitly calls out pip as "the preferred installer program".
Other new features have been added to pip over the years that will never be in easy_install. For example, pip makes it easy to clone your site-packages by building a requirements file and then installing it with a single command on each side. Or to convert your requirements file to a local repo to use for in-house development. And so on.
The only good reason that I know of to use easy_install in 2015 is the special case of using Apple's pre-installed Python versions with OS X 10.5-10.8. Since 10.5, Apple has included easy_install, but as of 10.10 they still don't include pip. With 10.9+, you should still just use get-pip.py, but for 10.5-10.8, this has some problems, so it's easier to sudo easy_install pip. (In general, easy_install pip is a bad idea; it's only for OS X 10.5-10.8 that you want to do this.) Also, 10.5-10.8 include readline in a way that easy_install knows how to kludge around but pip doesn't, so you also want to sudo easy_install readline if you want to upgrade that.
作为对fuzzyman回复的补充:
pip不会安装二进制包,并且在Windows上没有经过很好的测试。
由于Windows默认情况下没有编译器,pip通常不能
使用。easy_install用于安装Windows的二进制包。
这里有一个关于Windows的技巧:
您可以使用easy_install <package>来安装二进制包,以避免生成二进制文件
即使使用easy_install,也可以使用PIP uninstall <package>。
这只是一个变通的工作,为我的窗户。
实际上,如果不涉及二进制文件,我总是使用pip。
查看当前pip doku: http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install
我会在邮件列表上询问有什么计划。
以下是最新更新:
新支持的安装二进制文件的方式将是wheel!
它还没有达到标准,但差不多了。当前版本仍然是alpha: 1.0.0a1
https://pypi.python.org/pypi/wheel
http://wheel.readthedocs.org/en/latest/
我将通过使用wheel而不是eggs为PySide创建一个OS X安装程序来测试wheel。会回来报告这件事的。
干杯——克里斯
快速更新:
向车轮的过渡几乎结束了。大多数包都是支承轮。
我答应为PySide做轮子,去年夏天我就做了。工作好了!
提示:
到目前为止,一些开发人员未能支持轮式格式,只是因为他们忘记了
用setuptools替换distutils。
通常,通过替换setup.py中的这个单词就可以很容易地转换这样的包。