What is the best way to install python 2 on OS X?
I use brew
to install all my libraries/compilers/interpreters.
To install python
try this:
brew install python
Then add Python's binaries directory to your $PATH
in your ~/.profile
:
export PATH=`brew --prefix python`/bin:$PATH
I'd recommend you to install pip
, virtualenv
and virtualenvwrapper
to have better control over your environment too.
Have you tried ActivePython?
It includes a package manager (PyPM) that, by default, installs into your home directory (eg: ~/Library/Python/2.7
). Main scripts get symlinked in /usr/local/bin
; use the included pythonselect
to set the active Python version.
You don't have to bother installing .dmg packages, as PyPM is a binary package manager ... therefore you can install non-pure Python packages like NumPy without having to compile things yourself.
ActivePython can use Apple's Tcl/Tk or, if installed, ActiveTcl.
A "simplest, most general approach" in your documentation could be:
- Install ActivePython 2.7
- Open Terminal and type
pypm-2.7 install matplotlib ipython
In almost all cases, the best python to use is the one from http://python.org/. It sets up the paths correctly and doesn't overwrite anything. DMG package installs usually work automatically, as does python setup.py install
, and it's not too hard to get setuptools
to work. If you want per-user installs, it is easy to set up .pydistutils.cfg
and python automatically recognizes the path install_lib = ~/Library/Python/$py_version_short/site-packages