Snow Leopard Python 2.6 problems getting PIL to work
I have installed libjpeg and PIL, but when I try to save the JPG image, I always get this error:
ImportError: module _imaging C not installed
Any help is greatly appreciated!
I tried to import the _imaging w / Python interpreter to see what happened and got this:
>>> import _imaging
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
Expected in: dynamic lookup
source to share
I just hit this on SL as well and the problem is your libjpeg was built without the corresponding architecture. Assuming you are using MacPorts, run file /opt/local/lib/libjpeg.dylib
. The correct way is to build everything with MacPorts as +universal
see
Generic Binaries in MacPorts as it relates to PIL dependencies.
source to share
Many of these errors occur when compiling from source when you have previously installed python tools from fink or ports. For example, an error _jpeg_resync_to_restart
can occur if you have leftover libjpeg files in /opt/local/lib
. Try the following:
cd /opt/local/lib
sudo rm *jpeg*
Then recompile libjpeg (starting at make clean
), then recompiling PIL (starting at rm -Rf build
).
After that it import _imaging
should work. It's all the same to me.
source to share
Edit: Thanks for the added bug report. This appears to be a jpeglib issue on Snow Leopard. Have you tried this?
http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/
source to share