Install libjpeg and PIL on OS X Leopard

You will need these if you're working with ImageFields in Django.

I have been building my first site using the Python-based development framework Django and it is really fantastic! I am picking up some of it very fast (the concept of templates and template tags, for example) because of my experience with the PHP-based CMS ExpressionEngine, and some of it is totally foreign to me... but as I muddle through it, I can tell that I've begun to learn some very powerful tools, especially once I got Django working with the jQuery javascript library.

When working with images such as profile avatars, you need to have the Python Imaging Library installed, which also means installing the libjpeg library to compile PIL. I found a couple articles here and here but it seemed that only part of each worked for me. Last night I installed everything again on my PowerBook running Mac OS X Leopard 10.5.4, so I recorded the combination that worked for me:

1. If you haven't already, you must install the Apple Development Tools (XCode).
2. Download and install the Unix software installer Fink. The binary installers for the Mac worked great, both on my Intel and PowerPC machines.
3. Open a Terminal window and type:
  1. fink install libjpeg
  2. curl -O http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
  3. tar -xzf Imaging-1.1.6.tar.gz
  4. cd Imaging-1.1.6
  5. sudo python setup.py install
And that's it!
Technorati Tags: , , , , , , , , , ,