Installing Scientific Python on Mac OS X 10.8

posted in: Uncategorized | 0

Recently I had to reinstall Python with scientific tools on Mac OS X 10.8.

These are instructions that I read from the Internet to successfully install Python. [1,2]

PART I: Installing Python

Step 1. Remove old Python

We have to remove all previous installations of Python, except for the system’s Python distribution. Here’s the command to search our computer for Python.

We should remove other installed instances of Python except the one installed in /System.

Step 2. Install XCode Developer Tools

Now that we removed other copies of Python, it’s a good idea to install the latest Developer Tools from XCode. Go ahead and open XCode > Preferences to install those tools.

Step 3. Homebrew

We will use a wonderful packaging system for Mac, homebrew, to help us through the remainder of the process. The command for installing homebrew is:

Step 4. Modify Terminal Path

We must modify our path to accept homebrew-installed applications. This file is ~/.bashrc or ~/.bash_profile. See which file has stuff already in it.

Another option is to modify /etc/paths directly. Mine looks like this:

Step 5. Install Python

Python should be installed. –framework suffix ensures that Python is installed in the “Mac” way instead of the UNIX way.

Step 6. Python on the Path

After installing python, it has to be added to the path. Let’s edit ~/.bashrc or ~/.bash_profile to add another line:

Step 7. Update Python tools

Pip’s installation of Python tells us to update pip and distribute.

Step 8. Virtual environments for Python

Let’s install virtualenv.

Step 9. Virtualenv on the Path

Go back to ~/.bashrc or ~/.bash_profile and add virtualenv to the path. Here’s 3 more lines to add:

PART II: Installing Scientific Python

Step 10. Install NumPy.

Step 11. Install SciPy.

Step 12. Install matplotlib.

Step 13. Install IPython.

 References

[1] https://python-guide.readthedocs.org/en/latest/starting/install/osx/ [2] http://penandpants.com/2012/02/24/install-python/