问题描述
我安装枕头,之后我想做:
I installed Pillow, and after i want to do:
from PIL import Image
我收到以下错误:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 61, in <module>
ImportError: cannot import name _imaging
但是,如果我们单独导入,一切都很好,即:
However, if I import these separately, everything is fine, ie:
import _imaging
import Image
你知道问题可能是什么吗?
Do you know what the problem might be?
推荐答案
也是这个问题。如果您已安装PIL,然后在其上方安装枕头,可能会发生。
I ran into this problem as well. It can happen if you have PIL installed, then install Pillow on top of it.
转到/usr/local/lib/python2.7/dist-packages/和删除名称中包含PIL的任何东西(包括目录)。如果枕头的.egg文件在那里,你也可以删除它。
然后重新安装枕头。
Go to /usr/local/lib/python2.7/dist-packages/ and delete anything with "PIL" in the name (including directories). If the Pillow .egg file is there you might as well delete that too.Then re-install Pillow.
将python2.7替换为您使用的python版本。
substitute "python2.7" for the version of python you're using.
这篇关于ImportError:无法导入名称_imaging的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!