无法导入PIL库

时间:2018-05-04 20:46:35

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

我已成功在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

2 个答案:

答案 0 :(得分:1)

如果您使用Anaconda,可以尝试:

conda install Pillow

因为这适合我。

答案 1 :(得分:0)

Pil被剥离并用枕头代替。 Pillow是PIL的官方分支

使用pip安装或通常如何安装。

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

相关问题