Getting PIL Installed on OS X 10.6 Snow Leopard with JPEG Support

Now that I’m working on run my app with a remote MySQL setup, I’m kind of doing a system reset of sorts at the same time.

I had about 25 virtualenvs in various states of biochemical degradation, so I just flippin’ deleted’em.

All gone. Bye bye.

I’m going to need PIL in all of my virtualenvs, so I’m going to just install it into my current Python (2.6.4, installed from the binary at python.org). Of course, that probably won’t work since not everything in `site-packages` seems to get copied/linked over, but I’ll burn that bridge when I get to it.

Getting and Building PIL

I first downloaded the PIL 1.1.6 source kit, ran the usual `sudo python setup.py install` and got the message at the end about what types of files it would be able to process. JPEG was flagged as a no-go. Not being able to process JPEG files would make PIL pretty flippin’ useless.

Went and got the jpeg library, unarchived it, and followed the instructions at Proteus Technologies, to compile with `–enable-static` which PIL seems to need, at least according to that site.

$ tar zxvf jpegsrc.v7.tar.gz
$ cd jpeg-7
$ ./configure --enable-shared --enable-static
$ make
$ sudo make install

God, I love things that compile without any warnings or errors.

Went back to PIL and re-ran the install and it went like this:

)# sudo python setup.py install
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version       1.1.6
platform      darwin 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
              [GCC 4.0.1 (Apple Inc. build 5493)]
--------------------------------------------------------------------
--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--------------------------------------------------------------------
To check the build, run the selftest.py script.
running build_scripts
running install_lib
running install_scripts
changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/pilconvert.py to 755
changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/pildriver.py to 755
changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/pilfile.py to 755
changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/pilfont.py to 755
changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/pilprint.py to 755
running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info
Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info
creating /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL.pth

Yay!