easy_install
is part of setuptools
. For a while, distribute
was a separate fork of setuptools
that included its own easy_install
, and you had to put a bit of thought into which one you wanted, but that's no longer an issue; the two have merged back into one project. So, the question is, how do you get setuptools
?
- If you're using Apple's pre-installed versions of Python, you already have
setuptools
, with a workingeasy_install
, for all versions. You can also useeasy_install-2.5
, etc., for the earlier versions of Python that Apple also pre-installs. So there's nothing to do. - If you're using a Homebrew Python, it automatically installs
setuptools
by default, so again, nothing to do. - If you're using a third-party package manager that doesn't automatically install
setuptools
(as at least was true for MacPorts last time I checked), it probably has its own package forpython32-setuptools
orpython32-easy-install
or something like that. - Most of the "extra-batteries" distributions (ActiveState, Enthought, etc.) of Python similarly include
setuptools
, so again, nothing to do.
If you're using a Python.org binary, a custom-built Python with default configuration, etc., the standard setuptools
instructions for "Unix-based Systems including Mac OS X" work fine.
If you installed Python somewhere you don't have write access, you will need to sudo
the installation step, as in the second variant.
So:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python
And that's all there is to it.
All that being said, you almost never want to use easy_install
, except to install two things:
readline
, to replace the fake libedit-based support with real libreadline-based support. (And any other packages that don't work withpip
, but this is the only really popular one.)pip
, so you never need to useeasy_install
again.
Most of the cases above that include setuptools
also include pip
; the one exception is Apple pre-installed Python, where sudo easy_install pip
is the simplest way to get pip
.
For the cases that don't come with either, the standard documentation for installing pip
also works:
- Install or upgrade
setuptools
(as above) if you have a version older than 0.7. - Download get-pip.py.
python get-pip.py
Again, sudo
if you need to, and replace the python
with python3.3
or python2.6
or /opt/local/mypython/bin/python
or whatever to install for any non-default versions.
Finally, for upgrading, once you have any version of pip
, and setuptools
0.7 or later, it's as easy as you could imagine:
pip install --upgrade setuptools pip
Again, sudo
if necessary, and pip-3.3
or whatever if necessary.
Note that to make easy_install
or pip
actually useful, you may need a compiler toolchain. The easy way to do this is to install Xcode from the Mac App Store (free as of late 2013), launch Xcode, open Preferences, go to Downloads, and install the "Command Line Tools". This is sufficient for almost everything you'd ever want to do.
The one major exception is SciPy and related packages, for which you will also need a Fortran compiler. See this blog post for Python 2.x and this one for 3.x for details. If all of that looks scary to you, you may be happier using Enthought or one of the other pre-packaged scientific distributions.
One last thing: If you installed a non-Apple Python, and then upgraded your OS X (or Homebrew or MacPorts or Enthought or …) to a newer major version (e.g., from OS X 10.8 to 10.9), you may need some extra steps. For every case but OS X itself, they should be documented on the home page for whichever package manager or Python distribution you're using. For an OS X upgrade, reinstalling your third-party Python is usually the simplest solution if you run into a problem (after first verifying that you actually need a third-party Python in the first place), even if it means you have to reinstall your site packages.