Install Python on Mac OS X
Installing Python and its packages on Mac is neat, thanks to Brew and pip. There are alternative ways, e.g., using the graphic installation packages provided by Enthought or Anaconda. But they mess up the system in several ways (e.g., Enthough messed up the system path which could affect brew).
Install Python using homebrew
So here is how I installed Python on Mac OS X.
- Install homebrew (visit homebrew at http://brew.sh)
- Run
brew install python
in terminal (requires Xcode to be installed) - pip install packages (It may not be a good idea to use easy_install is pip is is superior to it in several ways). All the packages are installed in folder
/Library/Python/2.7/site-packages
. Update/uninstall is also quite easy.
Python provided by OS X
OS X comes with a version of Python installed at /usr/bin/python
. We’ll call this “system Python”. There are various problems with system Python:
- It can be old, for example OS X Yosemite provides 2.7.6 while the most recent now is 2.7.8.
- Updating OS X has the potential to change or break any updates you have made to the Python installation, including installation of Python packages.
- System Python has an unusual setup for some Python packages that makes it much more difficult to upgrade these packages.
- The system Python choose package from the system folder
/System/Library/Frameworks/Python.framework/Versions/...
rather than the pip installation folder/Library/Python/2.7/site-packages
. This means that even you install the new version of scipy, for example, via pip, the system Python will still load the old one. For more information, see https://github.com/MacPython/wiki/wiki/Which-Python