问题描述
我已经阅读了类似问题的答案,但似乎没有一个适合我的情况.尝试使用枕头时,出现此错误:
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
在我的/Library/Python/2.7/site-packages目录中,我有一个包含Image模块的PIL目录,然后我有一个包含_imaging.c的PIllow-master目录,所以我不明白为什么在Image中. py行63表示要从PIL导入_imaging.我也尝试从枕头母版上剪切_imaging.c并将其粘贴到PIL中,但是它不起作用.尝试导入图像时,我陷入了PIL.如果我在导入站点程序包时尝试将其导入,它将无法正常工作并显示没有名为PIL的模块".
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库并安装新的库:
Try to remove your PIL library and install new by:
pip install PIL --allow-external PIL --allow-unverified PIL
这篇关于使用枕头时出错:ImportError:无法导入名称_imaging的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!