Why use pip over easy
A tweet reads:
Don't use easy_install, unless you like stabbing yourself in the face. Use pip.
Why use pip over easy_install? Doesn't the fault lie with PyPI and package authors mostly? If an author uploads crap source tarball (eg: missing files, no setup.py) to PyPI, then both pip and easy_install will fail. Other than cosmetic differences, why do Python people (like in the above tweet) seem to strongly favor pip over easy_install?
(Let's assume that we're talking about easy_install from the Distribute package, that is maintained by the community)
Many of the answers here are out of date for 2015 (although the initially accepted one from Daniel Roseman is not). Here's the current state of things:
.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. 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
. 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. 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. pip
as "the preferred installer program". 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.
From Ian Bicking's own introduction to pip:
pip was originally written to improve on easy_install in the following ways
Another—as of yet unmentioned—reason for favoring pip is because it is the new hotness and will continue to be used in the future.
The infographic below—from the Current State of Packaging section in the The Hitchhiker's Guide to Packaging v1.0—shows that setuptools/easy_install will go away in the future.
Here's another infographic from distribute's documentation showing that Setuptools and easy_install will be replaced by the new hotness—distribute and pip. While pip is still the new hotness, Distribute merged with Setuptools in 2013 with the release of Setuptools v0.7.
链接地址: http://www.djcxy.com/p/4472.html上一篇: 如何使用Windows开发机器为iPhone开发?
下一篇: 为什么使用点子容易