Install Python

How to install Python/Numpy/Scipy on Mac

Shaowei Lin



UPDATE (23 Apr 2012): Please visit www.enthought.com for effortless installation of Python 2.7, NumPy, SciPy, etc. on a Mac.

These were the steps I took to install Python 2.7 on Mac OS 10.5 on 15 Nov 2011. Hopefully, the steps for other versions of Python and Mac OS will be similar.

** I've been warned that Python 3.x is significiantly different and backwards-incompatible with Python 2.7, so code that you write in Py2.7 may not run in Py3.x! Meanwhile, many useful publicly-available libraries have not been upgraded to Py3.x, so the situation is a little tricky here. Do what is best for your own needs.

1. Python

Go to http://python.org/download/ and download the appropriate Mac OS X Installer. For me, it was the "Python 2.7.2 Mac OS X 32-bit i386/PPC Installer".

Check that the installation is successful by running "python" from Terminal.

2. Nose

Nose is needed for running tests within Python. The website is at http://readthedocs.org/docs/nose/en/latest/.

Click on the "Download" link on the right sidebar, and click on the folder to the latest version of Nose. For me, it led me to the folder http://pypi.python.org/pypi/nose/1.1.2.

Download the "tar.gz" file you see there. Unpack the file.

From Terminal, navigate into the folder you just unpacked and type "python setup.py install".

3. NumPy

NumPy is a python package for mathematical computations.

I started from the links on http://www.scipy.org/Installing_SciPy/Mac_OS_X and eventually arrived at the SourceForge download site http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/.

From there, I chose the Mac OS X installer "numpy-1.6.1-py2.7-python.org-macosx10.3.dmg".

From Python, run the following test to make sure NumPy is correctly installed.
>>> import numpy as np
>>> np.test('full')

4. SciPy

SciPy is a python package for advanced mathematical computations. It builds on top of NumPy.

The steps are very similar to that for Numpy. I arrived at the SourceForge download site http://sourceforge.net/projects/scipy/files/scipy/0.10.0/.

From there, I chose the Mac OS X installer "scipy-0.10.0-py2.7-python.org-macosx10.3.dmg".

From Python, run the following test to make sure SciPy is correctly installed.
>>> import scipy
>>> scipy.test()

5. MatPlotLib

MatPlotLib (http://matplotlib.sourceforge.net/) is a python package for graphics in mathematical computations. It is necessary for the iPython (next step).

Following the links on the website, I came to the SourceForge download site http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/.

I could have picked the appropriate Mac OS X Installer, but instead, I downloaded the file "matplotlib-1.1.0.tar.gz". Unpack the file.

From Terminal, navigate into the folder you just unpacked and type "python setup.py install".

6. iPython

IPython(http://ipython.org/) provides a nice interface to Python.

From the download page http://ipython.org/download.html, pick the "compressed source archive in .tar.gz" file. Unpack the file. br>
From Terminal, navigate into the folder you just unpacked and type "python setup.py install".

Run "ipython -0 pylab" from Terminal to check that iPython and MatPlotLib were correctly installed.



CONGRATULATIONS! IT IS FINISHED! :)