Adding PIL (Python Imaging Library) to Mac OS X

I continue my newbie MacBook exploits, currently I’m enjoying the fragmented installation process on a Mac…why is it harder to get stuff installed than on both Ubuntu (lovely apt-get!) and Windows?

Installing the Python Imaging Library takes a couple of steps.  There is a 3rd party installer but it assumes you’ve installed their base Python2.5 install…but Py2.5 comes pre-installed on Macs now anyway.

Thankfully there are instructions here for adding a soft-link that lets the installer find the existing Python 2.5.  Next, get the PIL diskimage (via Python Mac) and this time it’ll install happily.

Next I created ~/.bash_profile (not .bash_rc as suggested in the article – it didn’t get picked up) and added the required:

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/

and then I started Python, did ‘from PIL import Image’ and all was well.  Woot-te-toot, now on with coding another ShowMeDo Club series (on File I/O for Python Beginners).

Ian is a Chief Interim Data Scientist via his Mor Consulting. Sign-up for Data Science tutorials in London and to hear about his data science thoughts and jobs. He lives in London, is walked by his high energy Springer Spaniel and is a consumer of fine coffees.

1 Comment

  • that`s waht i am looking for. thx I love my mac bit without pil dango & pinax wont run :(