PIL库导入失败
The PIL library import fails
作为 python 的初学者,我决定安装 python 解释器 3.4.4,以及用于 eclipse IDE 的 PyDev 插件。我也在用 windows 10.
我遇到了关于某些导入的问题,即:from PIL import Image, ImageTk
,这显然是一个未解决的导入。
我查看了某些与我的情况类似的问题,但大多数问题都给出了解决方案,例如安装从 linux apt-get 打包的。以下是我访问过的一些主题:
- Uninstalling and reinstalling Pillow and pip,
- Installing pillow-imaging-tk on Ubuntu,
- This topic which left me very confused,
- This one seemed helpful, but is on Unix OS again
所以请有人向我解释为什么我会看到这个错误,如果我绝对想使用 Eclipse、Pydev、windows 10 和 Python 3,我该如何纠正它。
对于 PyDev 中的 Python 导入问题,项目网站上的 interpreter configuration 页面是一个很好的起点。我最近有一个类似的问题,我通过在强制内置选项卡中添加一个模块来解决。
找到解决方案,这是我所做的:
- 设置 PYTHONPATH like it is shown in this article,确保 python.exe 可通过 cmd 访问,
- 通过 cmd,键入
pip install pillow
。或者,您可以从 Windows+R, 输入相同的命令
- (不确定是否相关步骤)通过 eclipse,
Windows->Preferences->PyDev->PythonInterpreter
删除您的解释器以重新添加它,
- 重新启动 eclipse。
作为 python 的初学者,我决定安装 python 解释器 3.4.4,以及用于 eclipse IDE 的 PyDev 插件。我也在用 windows 10.
我遇到了关于某些导入的问题,即:from PIL import Image, ImageTk
,这显然是一个未解决的导入。
我查看了某些与我的情况类似的问题,但大多数问题都给出了解决方案,例如安装从 linux apt-get 打包的。以下是我访问过的一些主题:
- Uninstalling and reinstalling Pillow and pip,
- Installing pillow-imaging-tk on Ubuntu,
- This topic which left me very confused,
- This one seemed helpful, but is on Unix OS again
所以请有人向我解释为什么我会看到这个错误,如果我绝对想使用 Eclipse、Pydev、windows 10 和 Python 3,我该如何纠正它。
对于 PyDev 中的 Python 导入问题,项目网站上的 interpreter configuration 页面是一个很好的起点。我最近有一个类似的问题,我通过在强制内置选项卡中添加一个模块来解决。
找到解决方案,这是我所做的:
- 设置 PYTHONPATH like it is shown in this article,确保 python.exe 可通过 cmd 访问,
- 通过 cmd,键入
pip install pillow
。或者,您可以从 Windows+R, 输入相同的命令
- (不确定是否相关步骤)通过 eclipse,
Windows->Preferences->PyDev->PythonInterpreter
删除您的解释器以重新添加它, - 重新启动 eclipse。