简体   繁体   中英

Pillow import error from _imaging.so / libjpeg.8.dylib on OSX

I've used Pillow in the past on OSX without problems, however I now get the following error.

  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 61, in <module>
    from PIL import _imaging as core
ImportError: dlopen(/Library/Python/2.7/site-packages/PIL/_imaging.so, 2):     Library not loaded: /usr/local/lib/libjpeg.8.dylib
  Referenced from: /Library/Python/2.7/site-packages/PIL/_imaging.so
  Reason: image not found

I've seen this question which appears to be a similar problem but I don't think I installed Pillow with brew.

I've also tried the solution from this question but the command

pip install PIL --allow-external PIL --allow-unverified PIL

dosent seem to work and I get an error (no such option: --allow-unverified)

Lastly, I've tried to recreate the symbolic link to libjpeg.8.dylib but that also did not make any difference.

Would anyone know how to fix this error? Do I need to do something to relink _image.so aswell as libjpeg?

Python PIL was deprecated eons ago and you should not attempt to use it anymore.

What you want is python[23] -m pip install Pillow

PS. Using pip command will be deprecated soon because of confusions regarding python interpreters, instead of calling pip ... everyone should use only python -m pip ... which assures that is calling the right interpreter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM