Python:'pyautogui' 没有属性 'screenshot' (Windows) [英] Python: 'pyautogui' has no attribute 'screenshot' (Windows)

查看:160
本文介绍了Python:'pyautogui' 没有属性 'screenshot' (Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 pyautogui 模块截取屏幕截图,但不断收到此错误

<预><代码>>>>图像 = pyautogui.screenshot()回溯(最近一次调用最后一次):文件<stdin>",第 1 行,在 <module> 中AttributeError: 模块 'pyautogui' 没有属性 'screenshot'

有什么我遗漏的吗?使用 Python 自动化无聊的东西 中的一章说,因为我在 Windows 上,所以我不需要下载除 pyautogui 本身以外的任何东西,以使其正常工作.有谁知道为什么会发生这种情况?提前致谢.

我正在使用 Anaconda,所以我已经有了 Pillow.

解决方案

from pyautogui import screenshotUtilim=screenshotUtil.screenshot()打印 im.getpixel((850, 850))

我试过了.它似乎与文档不同.希望这是有帮助的.

I am trying to take a screenshot with the pyautogui module, but keep getting this error

>>> image = pyautogui.screenshot()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pyautogui' has no attribute 'screenshot'

Is there something I'm missing? The chapter in Automate the Boring Stuff with Python said that as I'm on Windows, I shouldn't need to download anything other than pyautogui itself for this to work. Anyone know why this might happen? Thanks in advance.

EDIT: I am using Anaconda so I already have Pillow.

解决方案

from pyautogui import screenshotUtil

im=screenshotUtil.screenshot()

print im.getpixel((850, 850))

I have tried. It's seem to different from the document. to hope this is helpful. ­­­­­­­­­­­­­­­­­­­­­­­­­­

这篇关于Python:'pyautogui' 没有属性 'screenshot' (Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆