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

The is my .profile stored in my user directory root

[frodo@theshire.local] Tue Apr 08 ~

[11] 01:11:12—> cat .profile

#
# /.profile OS X Leopard

# Setting the path for MacPorts.

export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:~/bin:$PATH
# Customize Command Prompt

export PS1=’n[u@H] d w n[#] t—> ‘

# Example prompt

# [frodo@theshire.local] Sun Dec 09 ~
# [12] 19:30:20—>

# Color Your OS X Command Prompt
# Can also be put in ~/.bash_profile

export CLICOLOR=1

export LSCOLORS=ExFxCxDxBxegedabagacad

# List of processes and users running
echo

w

# Prints Calendar
echo

cal

# Here’s a whole list of switches to help you customize your prompt:

# a an ASCII bell character (07)
# d the date in ‚ÄúWeekday Month Date‚Äù format (e.g., ‚ÄúTue May 26‚Ä?)

# e an ASCII escape character (033)

# h the hostname up to the first

# H the hostname
# n newline

# r carriage return

# s the name of the shell, the basename of $0 (the portion following the final slash)

# t the current time in 24_hour HH:MM:SS format

# T the current time in 12_hour HH:MM:SS format

# @ the current time in 12_hour am/pm format

# u the username of the current user

# v the version of bash (e.g., 2.00)

# V the release of bash, version + patchlevel (e.g., 2.00.0)

# w the current working directory

# W the basename of the current working directory

# ! the history number of this command

# # the command number of this command

# $ if the effective UID is 0, a #, otherwise a $

# nnn the character corresponding to the octal number “nnn”

# a backslash

# [ begin a sequence of non_printing characters

# ] end a sequence of non_printing characters

Navigation