问题
I followed these instructions:
http://proteus-tech.com/blog/cwt/install-pil-in-snow-leopard/
And everything went as described.
However, at the end, I tried running:
python selftest.py
to verify that everything is working properly, but I get:
*** The _imaging C module is not installed
I then run the python interpreter and tried:
import _imaging
and get this error:
Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart Referenced from: /Library/Python/2.6/site-packages/PIL/_imaging.so Expected in: flat namespace in /Library/Python/2.6/site-packages/PIL/_imaging.so
This is on my first Mac, so apologize if I'm missing anything obvious, but any help you could provide would be greatly appreciated.
Thanks!
回答1:
The problem happens because jpeglib is not available as part of standard MAC OS X distribution for Leopard and Snow Leopard.
The solution is as follows: - compile lib jpeg - make sure tha libjpeg62.dylib is available on your DYLD_LIBRARY_PATH (you might like to put it in places like /usr/local/lib)
Useful instructions are available here
回答2:
Ok, got it working thanks to Shailesh's help. First, I ran this:
otool -L /Library/Python/2.6/site-packages/PIL/_imaging.so
to see where the dependencies were. I removed those references to libjpeg, and then recompiled libjpeg and PIL (following the instructions in the link below) and then everything worked.
http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/
来源:https://stackoverflow.com/questions/1867250/having-trouble-installing-pil-in-snow-leopard