📜 ⬆️ ⬇️

Fix Python Imaging (PIL) in Snow Leopard

After switching to Snow Leopard in Django, ImageFields stopped working. The reason turned out to be inoperable PIL, and more precisely in its binding to libjpeg.
(typical error message: ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart )

The solution to the problem is partially described here.
swing from here :
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config/config.sub .
cp /usr/share/libtool/config/config.guess .
./configure --enable-shared --enable-static
make
sudo make install


However, I was “lucky” and I was among those who didn’t work right away - the reason was in the “zoo” of the installed libjpegs.
So, do the following:
1. We look at all dependences _imaging:
otool -L /Library/Python/2.6/site-packages/PIL/_imaging.so
2. We get something like: /Library/Python/2.6/site-packages/PIL/_imaging.so:
/sw/lib/ libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
/Library/Python/2.6/site-packages/PIL/_imaging.so:
/sw/lib/ libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)

Then you can solve in two ways:
a) delete the "zoo" library (in my case - from / sw / lib and re-assemble everything anew)
b) if deleting is not an option, then you can link the Python _imaging to the correct, freshly install_name_tool -change /sw/lib/ libjpeg.62.dylib /usr/local/lib /libjpeg.62.dylib _imaging.so
library: install_name_tool -change /sw/lib/ libjpeg.62.dylib /usr/local/lib /libjpeg.62.dylib _imaging.so
install_name_tool -change /sw/lib/ libjpeg.62.dylib /usr/local/lib /libjpeg.62.dylib _imaging.so

After that, everything should work :)

')

Source: https://habr.com/ru/post/72549/


All Articles