【发布时间】:2021-01-19 01:04:31
【问题描述】:
我已经使用以下命令在 Windows 8.1 for Python 3 中安装了 PILLOW 模块。
pip install pillow
安装成功。
不幸的是,当我尝试使用以下语句在其中导入图像子模块时,出现导入错误。
from PIL import image
错误: ImportError:无法从“PIL”(C:\Program Files\Python38\lib\site-packages\PIL_init_. py)
虽然下面的语句给了我一个错误的“PIL”。
image = PIL.Image.open("Capture Image.PNG")
错误:未定义变量:'PIL'Python(undefined-variable)
我尝试过下面列出的类似帖子,但它们并没有帮助我解决问题。
- Pip install Pillow: "no module named Pillow?"
- Pillow installed, but getting "no module named pillow" when importing
- Python pillow module not importing properly
你能解释一下我在这里缺少什么吗?
问候, 奇兰塔卡
【问题讨论】:
-
我无法理解这个问题的问题。仍然没有人回答这个问题。
-
不是
from PIL import Image吗?注意Image的大写I。 -
另外,在做其他事情之前请先学习python的基础知识。你导入了
Image而不是PIL所以image = Image.open("Capture Image.PNG")。 -
成功了。谢谢@dragon2fly 其实我正在学习基础知识。这就是我遇到此错误的原因。
标签: python-3.x pip python-import python-module