一条推文写道:

不要使用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.

其他回答

这里的许多答案在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.

只是遇到了一个特殊的情况,我必须使用easy_install而不是pip,或者我必须直接提取源代码。

对于GitPython包,pip中的版本太旧,为0.1.7,而easy_install中的版本是最新的,为0.3.2.rc1。

我使用的是Python 2.7.8。我不确定easy_install和pip的底层机制,但至少有些包的版本可能彼此不同,有时easy_install是版本较新的包。

easy_install GitPython

更新:正如一些人认为的那样,setuptools吸收了分发而不是其他方式。Setuptools是最新的,包含了最新的distutils更改和wheel格式。因此,easy_install和pip现在或多或少处于同等地位。

来源:http://pythonhosted.org/setuptools/merge-faq.html why-setuptools-and-not-distribute-or-another-name

pip不会安装二进制包,并且在Windows上没有经过很好的测试。

由于Windows默认没有编译器,pip通常不能在那里使用。easy_install用于安装Windows的二进制包。

原因有两个,可能还有更多:

PIP提供了一个卸载命令 如果安装中途失败,PIP将使您处于干净的状态。