Python Programming on Mac OS X

These are the pieces needed for a basic working Python setup on OS X. I don't know of any way to get the numarray package working in OS9 or earlier.

Python and Numarray

I've been using the Python programming language for modeling work. The primary reason is that it's an easy programming language to learn. This is one of Python's primary goals; teaching it to biologists fits nicely with their "Computer Programming For Everybody" ideas. Python is also free and available for a wide variety of platforms.

The numarray add-on package gives an efficient multi-dimensional array type to Python. If you don't know what that means, just trust me that this modeling stuff would be a lot uglier without it.

The easiest way to get both of these is to use the Darwinports packages. These provide ports of Unix tools for OSX.

  1. Start by downloading the Darwinports installer.
  2. Install the package.
  3. Open a Terminal and type this command to install Python and numarray:
    sudo /opt/local/bin/port install python24 py-numarray
  4. You can now start Python in the shell with the python2.4 command in the shell. For example.
    python2.4 code.py

Copyright © , last modified 2010-07-14.