【问题标题】:Can't import PIL library无法导入 PIL 库
【发布时间】:2018-05-04 20:46:35
【问题描述】:

我已成功在我的 macbook 上安装了适用于 python 3 的枕头。但我仍然无法使用 PIL 库。我尝试卸载并再次安装它。我也试过import Image 没有from PIL。不过,我没有安装 PIL。它说

找不到满足 PIL 要求的版本(来自 版本:)

from PIL import Image  


--------------------------------------------------------------------------- ImportError                               Traceback (most recent call last) <ipython-input-4-b7f01c2f8cfe> in <module>()
----> 1 from PIL import Image

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PIL/Image.py in <module>()
     58     # Also note that Image.core is not a publicly documented interface,
     59     # and should be considered private and subject to change.
---> 60     from . import _imaging as core
     61     if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
     62         raise ImportError("The _imaging extension was built for another "

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PIL/_imaging.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime   Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12)   Expected in: /usr/lib/libSystem.B.dylib  in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib

【问题讨论】:

标签: python python-3.x macos python-imaging-library


【解决方案1】:

如果你使用Anaconda,你可以试试:

conda install Pillow

因为这对我有用。

【讨论】:

    【解决方案2】:

    Pil 被贬低并被枕头取代。 Pillow 是 PIL 的官方 fork

    使用 pip 或通常的方式安装。

    https://pillow.readthedocs.io/en/5.1.x/index.html

    【讨论】:

      猜你喜欢
      • 2020-04-26
      • 2022-01-09
      • 2012-11-09
      • 2018-09-17
      • 2016-08-22
      • 2021-03-07
      • 1970-01-01
      • 2021-08-31
      • 2019-12-03
      相关资源
      最近更新 更多