无法导入名称“Image”

2024-06-01 22:52:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试设置Python映像库,但我收到一个错误。

>>> from imaging import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Image'

我已经在Windows10上安装了Python3.5.2。这里的总体目标是使用图像处理库来分析一些图像。我想做的事情,如计数所有非白色(或相对白色)像素,注意它们的位置,然后与另一个类似的图像比较。

我的目录:

enter image description here

enter image description here

enter image description here


Tags: from图像imageimportmost错误stdinline
2条回答

您可能将您的项目命名为“PIL.py”,请更改它:)

您导入的模块不正确。 安装我使用的PIL

 pip install pillow

然后您可以使用:

from PIL import Image

在您的python代码中。

相关问题 更多 >