Monthly Archives: March 2012

How to install PIL on Mac OS X for Google App Engine?

If the following error message appears when starting an application using Google App Engine on Mac OS X: “Could not initialize images API; you are likely missing the Python “PIL” module. ImportError: No module named _imaging”

  1. Install MacPorts [1]
  2. Install Python 2.5 with sudo port install python25
  3. Install Pil for Python 2.5 with sudo port install py25-pil
  4. using the finder, open ~/.MacOSX/environment.plist and edit the PYTHONPATH variable [2]
  5. In the Google App Engine launcher Preferences set /opt/local/bin/python2.5 as Python Path
  6. Restart the Google App Engine launcher
  7. Run an application
  8. The error regarding PIL has disappeared
  9. Let’s code!


[2] Screenshot presenting the settings of the environment.plist file (PYTHONPATH=/opt/local/lib/python2.5/site-packages)

Edit the PYTHONPATH on ~/.MacOSX/environment.plist

Window presenting the environment variable named PYTHONPATH

window presents the environment variable PYTHONPATH