0xbadbeef
0xbadbeef

Reputation: 141

Installing PIL on Snow Leopard

Hey, i have a problem installing PIL on Snow.

I have a clean installation of macports after the upgrade to SL and installed from source the jpeg library following the OS specific installation instructions. Installing PIL with pip goes well but when i try to import the _imaging module i get the following message:

Traceback (most recent call last):
File "<string>", line 1, in <module> ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): no suitable image found. Did find: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so: mach-o, but wrong architecture

Upvotes: 5

Views: 4703

Answers (4)

ApPeL
ApPeL

Reputation: 4911

I had the same problems, and actually created a small tutorial on how to resolve this. getting a working copy of PIL, libjpeg and Imaging on Snow Leopard or even Lion

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.

Upvotes: 1

Ned Deily
Ned Deily

Reputation: 85035

MacPorts already has a PIL port that will do all the work for you!

sudo port install py26-pil

You should first go into the site-packages directory and elsewhere to remove the stuff you installed manually, though. MacPorts will install all the necessary dependent libraries.

Upvotes: 3

pithyless
pithyless

Reputation: 1689

PIL on Mac OS X has been a pain point for many of my friends. These instructions seem to often help speedup the enlightenment process:

http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/

Good luck!

Upvotes: 2

inspectorG4dget
inspectorG4dget

Reputation: 113905

I'm not entirely certain (I use a PC myself), but I think that you might find something interesting here

May the force be with you

Upvotes: 0

Related Questions