Search code examples
pythondjangopython-imaging-librarylibjpeg

Installing PIL with JPEG support on Mac OS X


I posted a question before regarding this subject, and read other ones posted before, but none has successfully solved my problem.

I am trying to install PIL on Mac OS X Lion, as I need it for a Django application. I also need JPEG support, so I need a JPEG decoder as well.

I have tried to download the libjpeg sources and compile them, and install PIL, but it doesn't recognize the directory.

So what I would like, and I believe this exists somewhere, is a method to install both PIL and libjpeg with a package installer, without the need for any compilation whatsoever!

Thank you in advance for every reply.


Solution

  • I installed libjpeg and PIL on Snow and it was migrated without problems to Lion.

    I think however that you have the same problem I faced with installing libjpeg 7 on Snow. The solution for me was :

    • Make sure that you are NOT using GCC 4.0. That means those export lines in your .bash_profile file that you needed to get MySQLdb working now need to go away.
    • get (http://www.ijg.org/files/jpegsrc.v7.tar.gz) and do the usual ./configure && make && make install (or whatever the readme says).
    • Before installing PIL but after installing libjpeg, change the “JPEG_ROOT = None” line in my setup.py file to “JPEG_ROOT = libinclude(“/usr/local”)”

    I got this from a comment on this blog.

    Afterwards you can reinstall PIL through pip or easy_install. Make sure all the compiled stuff from your last run is deleted (sometimes you need to do this manually). I used virtualenv and pip.