问题描述
我要运行的单行如下:
from PIL import Image
这看起来似乎很简单,但却给出了一个错误:
However simple this may seem, it gives an error:
Traceback (most recent call last):
File "C:\...\2014-10-22_12-49.py", line 1, in <module>
from PIL import Image
File "C:\pyzo2014a\lib\site-packages\PIL\Image.py", line 29, in <module>
from PIL import VERSION, PILLOW_VERSION, _plugins
ImportError: cannot import name 'VERSION'
如果有帮助,我从 https://pypi.python.org/pypi/Pillow/安装了枕头2.6.1 (文件Pillow-2.6.1.win-amd64-py3.4.exe
)在运行此程序之前(在我已经卸载了som PIL
安装之前).该脚本在Python版本3.4.1的Pyzo中运行.
In case that's helpful, I installed pillow from https://pypi.python.org/pypi/Pillow/2.6.1 (file Pillow-2.6.1.win-amd64-py3.4.exe
) before running this (before that there was already som PIL
install, which I uninstalled). The script is run in Pyzo with Python version 3.4.1.
出了什么问题,如何导入Image
?
What is going wrong, how can I import Image
?
推荐答案
我有相同的错误.这是我的工作流程.我首先使用
I had the same error. Here was my workflow. I first installed PIL (not Pillow) using
pip install --no-index -f https://dist.plone.org/thirdparty/ -U PIL
然后我找到了Pillow并使用
Then I found Pillow and installed it using
pip install Pillow
解决我的问题的是卸载并重新安装Pillow
What fixed my issues was uninstalling both and reinstalling Pillow
pip uninstall PIL
pip uninstall Pillow
pip install Pillow
这篇关于为什么Python无法从PIL导入图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!