当我运行以下
from tkinter import *
from PIL import ImageTk, Image
root.mainloop()
我有
Traceback (most recent call last):
File "image_viewer.py", line 2, in <module>
from PIL import ImageTk, Image
ImportError: No module named PIL
但我已经安装了 Pillow,一切都很好。
原文由 nono.qwerty28 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用 Pillow 是“新”或 PIL 的替代品,但具有同名模块以保持兼容性:
另外,正如评论中所建议的,也许您只是使用了错误的 python 二进制文件,请尝试检查您是否在虚拟环境中/不在虚拟环境中或检查
python
与python3
之间的差异---
vspython2
在你的系统上: