Pyinstaller troubles with Pillow

2019-06-27 15:48发布

I'm trying to use pyinstaller, on OSX Mavericks, with one a Python script. Pyinstaller compiles and packs along until it finds an error with the Pillow library.

ImportError: dlopen(/Users/Rodolphe/.python-eggs/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg tmp/PIL/_imaging.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /Users/Rodolphe/.python-eggs/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg-tmp/PIL/_imaging.so
Reason: Incompatible library version: _imaging.so requires version 13.0.0 or later, but libjpeg.8.dylib provides version 9.0.0

It looks like Pyinstaller and Pillow are not getting along (it seems to be a known fact: http://www.pyinstaller.org/ticket/745 ). Is there a way around it? Should I try uninstalling Pillow and installing Pil instead (I chose Pillow out of discouragement from Pil's reluctancy to install on Mavericks, to begin with)? Or maybe update libjpeg.8.dylib to version 13.0.0 as it seems to be the problem?

[EDIT] I have updated libjepeg thanks to the advice from @mimi.vx I now have another error at the very end of the process:

IOError: [Errno 20] Not a directory: '/Library/Python/2.7/site-packages/Pillow-2.2.1-py2.7-macosx-10.9-intel.egg/PIL/_imaging.so'

I tried reinstalling Pillow so Pyinstaller would maybe get the directory, but no luck yet...

[RE-EDIT] Using py2app instead of pyinstaller worked for me!

2条回答
Explosion°爆炸
2楼-- · 2019-06-27 16:28

Pyinstaller was behaving strangely while importing PIL. I tried using py2app ( http://pythonhosted.org/py2app/ ) instead, and it worked like a charm. No lib ray import trouble or anything. I'd recommend it.

查看更多
小情绪 Triste *
3楼-- · 2019-06-27 16:30

Yes, first try update libjpeg

Good help for OS X can be found in this blog http://brantsteen.com/blog/python-27-libjpeg-pil-on-osx/

libjpg latest source is here www.ijg.org

And Pillow recommended install on OS X is described in pypi.python.org/pypi/Pillow/2.2.1

It is over homebrew $ brew install libtiff libjpeg webp littlecms

查看更多
登录 后发表回答