Python Easy Install on OS X 10.5 Leopard

For an excellent and concise version of this please read http://dev.fprimex.com/learning-python/installing-python-on-mac
It also includes extremely easy instructions on installing the excellent SPE Python editor.

With Python when you want to install a package on the Internet you can either manually install it or use the Python Package Index.

The Python Package Index is a repository of software for the Python programming language. There are currently are nearly 4,000 packages as of April 2008.
This post is based on my experience on following the installation instructions for the Easy Install

To install it on OX X 10.5 Leopard you must do the following

1. Create a folder for you python files to be run from, e.g. ~/bin

2. Update ~/.profile to include ~/bin in the search path.

3. Make a new text file called .pydistutils.cfg in the ~/ folder

With a user named frodo, we would have:

/Users/frodo/.pydistutils.cfg

[install]
install_lib = /Library/Python/$py_version_short/site-packages
install_scripts = /Users/frodo/bin

The default install library location for Leopard is

/Library/Python/2.5/site-packages because $py_version is replaced with 2.5, which is the version of Python which comes with Leopard.
This folder is where all your installed libraries are kept once they are downloaded and installed.

4. Download ez_setup.py, to ~/bin (in this case /Users/frodo/bin) and run it. You should get output similar to this:

[frodo@theshire.local] Tue Apr 08 ~/bin
[14] 00:33:30–> python ez_setup.py
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c8-py2.5.egg
Processing setuptools-0.6c8-py2.5.egg
Copying setuptools-0.6c8-py2.5.egg to /Library/Python/2.5/site-packages
Adding setuptools 0.6c8 to easy-install.pth file
Installing easy_install script to /Users/frodo/bin
Installing easy_install-2.5 script to /Users/frodo/bin
Installed /Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg
Processing dependencies for setuptools==0.6c8
Finished processing dependencies for setuptools==0.6c8

Congratulations, it is now installed. You should see some eggs 🙂 .egg and .pth files in your site-packages folder now:

[frodo@theshire.local] Tue Apr 08 /Library/Python/2.5/site-packages
[14] 01:28:18–> ls -la
total 664
drwxrwxr-x 6 root admin 204 8 Apr 00:34 .
drwxrwxr-x 3 root admin 102 9 Oct 12:33 ..
-rw-rw-r– 1 root admin 119 6 Oct 2007 README
-rw-r–r– 1 frodo admin 214 8 Apr 00:34 easy-install.pth
-rw-r–r– 1 frodo admin 324858 8 Apr 00:34 setuptools-0.6c8-py2.5.egg
-rw-r–r– 1 frodo admin 29 8 Apr 00:34 setuptools.pth

5. Now what? Have at look at the tutorial for the Python Package Index

see what you like, e.g. ipython, then:

[frodo@theshire.local] Wed Apr 09 ~/bin
[21] 01:21:12–> easy_install ipython
Searching for ipython
Reading http://pypi.python.org/simple/ipython/
Reading http://ipython.scipy.org
Reading http://ipython.scipy.org/dist
Best match: ipython 0.8.2
Downloading http://ipython.scipy.org/dist/ipython-0.8.2-py2.5.egg
Processing ipython-0.8.2-py2.5.eggcreating /Library/Python/2.5/site-packages/ipython-0.8.2-py2.5.egg
Extracting ipython-0.8.2-py2.5.egg to /Library/Python/2.5/site-packages
Adding ipython 0.8.2 to easy-install.pth file
Installing ipython script to /Users/frodo/bin
Installing pycolor script to /Users/frodo/bin Installed /Library/Python/2.5/site-packages/ipython-0.8.2-py2.5.egg
Processing dependencies for ipython Finished processing dependencies for ipython

Read more