尝试使用枕头库加载图像时出现属性错误

问题描述 投票:0回答:1

我正在使用 Pillow 库在 Python 课程中进行练习,在我的课程中,他们要求我使用 Pillow 库,以便我可以打印图像、加载和保存图像,但它给出了此属性错误,可能是库有一些更新导致删除了这个函数吗?

in <module>
    screenshot.show("Teste.png")
    ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.ImageGrab' has no attribute 'show'

我查看了文档,但 image.show 仍然存在...我需要下载任何其他软件包吗?

我查看了文档,在互联网上进行了搜索,但没有任何关于...

python python-3.x
1个回答
0
投票

我想你也是这样的

screenshot = ImageGrab

因为当我使用这个时

screenshot.show()
向我显示你的错误。

但必须如此

screenshot = ImageGrab.grab()
© www.soinside.com 2019 - 2024. All rights reserved.