简体   繁体   中英

Error using Pillow: ImportError: cannot import name _imaging

I've read the answers for similar questions but none of them seem to work for my situation. When trying to use Pillow, I get this error:

>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 63, in <module>
 from PIL import _imaging as core
ImportError: cannot import name _imaging

In my /Library/Python/2.7/site-packages directory I have one PIL directory which contains the Image module and then I have PIllow-master directory which contains _imaging.c, so I don't understand why in Image.py line 63 says to import _imaging from PIL. I've tried also to cut _imaging.c from Pillow-master and paste it in PIL but it doesn't work. When trying to import Image, I'm into PIL. If I try to import it while I'm into site-packages it doesn't work and says "no module named PIL".

尝试删除您的PIL库并通过以下方式安装新的PIL库:

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

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