views:

112

answers:

1

I'm trying to use PIL for a Google App Engine project. I've installed PIL using the installer from pythononmac.org but it doesn't seem to do anything, or at least neither I nor Python can find the files. I'm running Python 2.5.1.

+3  A: 

The installers found on that page were designed to be used with the python 2.5 installer found there. Note that most of the packages are now out-of-date. The PIL installer uses the site-packages library in the framework used by the 2.5 Python on that page and by the more up-to-date python.org installer: /Library/Frameworks/Python.framework/Versions/2.5. The Apple-supplied Python 2.5 (/usr/bin/python2.5 in OS X 10.5) looks for site-packages in a different location: /Library/Python/2.5. If you first install the python.org (or the pythonmac.org) 2.5, that python can be invoked by /usr/local/bin/python2.5 and the PIL installer package should work with it.

Unfortunately, installing PIL on OS X is more complicated than many other python packages because of its dependence on third-party libraries not supplied by Apple in OS X. While it is possible to build it on your own, you may be better off using a more up-to-date version of python with PIL from MacPorts, for example (see packages py25-pil or py26-pil).

I do not recommend using the symlink trick advocated by some bloggers (for instance, here) as this can end up contaminating the Apple-supplied Python and complicating support of multiple Python versions when you want to upgrade to python 2.6 and/or 3.1.

Ned Deily
Thanks for the clarification. I ended up installing Python from the package on pythononmac.org and then magically PIL started working. I also had to give GoogleAppEngineLauncher the exact path to the newly install version of Python. What would be the advantage of using using MacPorts?
donut
If it all works for you and you don't need any new features in Python 2.6 and you don't run into bugs fixed in later versions of 2.5 or 2.6, there's probably no pressing need to upgrade at this point.
Ned Deily
Well, turned out I did need a later version of Python 2.5 and MacPorts worked great for it. Thanks for the suggestion.
donut