python - OSX Pillow 不兼容的库版本 libtiff.5.dylib 和 libjpeg.8.dylib

标签 python macos pillow

我在尝试在任何脚本上使用 Pilow 时遇到此错误:

  File "/Users/antonio/WWW/myproj/myproj/functions.py", line 12, in <module>
    from PIL import Image, ImageOps
  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 53, 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: /usr/local/lib/libtiff.5.dylib
  Reason: Incompatible library version: libtiff.5.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 9.0.0

谁能帮帮我?

最佳答案

我有同样的问题,我不得不重新安装 pillow 并且所有都是依赖项。 我的一些符号链接(symbolic link)不好。

首先你必须:

brew doctor

然后看看你是否有一些错误。我的是这样的:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libjpeg.8.dylib
/usr/local/lib/libpng.3.dylib
/usr/local/lib/libpng12.0.dylib
/usr/local/lib/libpng14.14.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
/usr/local/lib/libjpeg.la
/usr/local/lib/libpng12.la
/usr/local/lib/libpng14.la
/usr/local/lib/libpng15.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

 Unexpected .pc files:
/usr/local/lib/pkgconfig/libpng12.pc
/usr/local/lib/pkgconfig/libpng14.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
/usr/local/lib/libjpeg.a
/usr/local/lib/libpng12.a
/usr/local/lib/libpng14.a

所以我决定清除我安装的所有错误和依赖项:

brew uninstall pillow
brew uninstall libpng
brew uninstall libjpeg
brew uninstall webp
brew uninstall libtiff
brew uninstall littlecms

brew prune => to clean symlink

当我的 brew doctor 没有任何错误时,我只需运行 brew install pillow 一切正常。

希望对你有帮助。

关于python - OSX Pillow 不兼容的库版本 libtiff.5.dylib 和 libjpeg.8.dylib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22728468/

相关文章:

Python 库 pdfplumber 不提取行

macos - 为什么 FIFinderSyncController.isExtensionEnabled 总是返回 false?

python - 使用 PIL 将 numpy 数组保存为 TIFF 序列

Python Pillow 未在 OSX 下安装

python - Pillow (PIL) 不支持 PNG 文件。如何安装 ZLIB 压缩库?

python - 如何解决 FOREIGN KEY 约束失败

python - 静态编译 Python

python - 如果程序返回溢出错误,如何让程序等待?

objective-c - objective-c : How to know the progress of unzipping in using ZipArchive

macos - “此类型的文件可能会损害您的计算机的mac no keep选项”-是否没有“Keep”选项? macOS HS