OSX Leopard, App Engine and Python's PIL libraries

Running Google App Engine on OSX Leopard is fairly straight-forward except for the fact Leopard does not ship with the Python PIL imaging libraries. One way of resolving this problem is to use MacPorts to compile your own Python 2.5 libraries. Install MacPorts and then from the Terminal run:

sudo /opt/local/bin/port install py25-pil
sudo /opt/local/bin/port install py25-socket-ssl
sudo /opt/local/bin/port install py25-hashlib

Finally edit the /etc/profile file...

sudo nano /etc/profile

...and add the following entry at the bottom:

export PYTHONPATH=/opt/local/lib/python2.5/site-packages

If you want the App Engine launcher to recognise this new version of Python open the application's preferences and set the path to the python2.5 executable (see screenshot).