Check out the Latest Articles:
Python 2.7, OS X Lion and PIL, _imaging and Image

My default version of Python was still on 2.6 so I had to switch to 2.7

defaults write com.apple.versioner.python Version 2.7

get v8c of jpeg
cd into jpeg directory.

sudo make clean
CC="gcc -arch i386" ./configure --enable-shared --enable-static
make
sudo make install

get imaging i am using 1.1.6

untar
cd into imaging
sudo rm -rf build
vi setup.py
JPEG_ROOT = libinclude(“/usr/local/lib”)
sudo python setup.py install

And it’s that simple

Run your python interpreter,

import PIL
import _imaging
import Image

if all is well, then your all set.



  1. maco on Thursday 21, 2011

    So it’s the same as with Snow Leopard only jpeg needs to be version upgraded.

  2. Arno Smit on Thursday 21, 2011

    correct

  3. Konstantin on Thursday 21, 2011

    Hi Arno,

    Thanks for pointing me in the right direction. However, in my case (upgrade from SL to Lion iMac 2009), the i386 libraries were the showstoppers. I have removed two i386 libjpeg.dylib files (one from Fink:/sw/llib – the other compiled from sources:/usr/local/lib) and left the macports version which was universal. Then all I had to do was

    $ sudo pip install PIL

    And everything works great, even after I put the removed libraries back.

  4. Fady Kamal on Thursday 21, 2011

    i did it but i don’t have Xcode and i still get error in

    import _imaging

    is it because of xcode ?

  5. Arno Smit on Thursday 21, 2011

    Hi Fady.

    Yes you need to have Xcode installed in order to make this work.

    Regards