Skip to main content
 首页 » 编程设计

python之Pyautogui截图函数返回AttributeError 'module'对象没有属性

2024年08月20日34TianFang

我已经安装了 Python 3.4 和 Pillow。所有其他功能都与 pyautogui 相关,只有屏幕截图和其他图像识别功能不起作用。

>>> import pyautogui 
>>> pyautogui.locateOnScreen('chrome.PNG') 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
AttributeError: 'module' object has no attribute 'locateOnScreen' 

屏幕捕获功能也显示相同的结果。

在 windows 7 操作系统中

我已阅读以下链接,但没有一个结果对我有用 Python: 'pyautogui' has no attribute 'screenshot' (Windows)

请您参考如下方法:

通过在 pip 中提及它来尝试下载确切的版本。

pip install PyAutoGUI-0.9.35 

或

pip install pyautogui==0.9.35 

这对我有用。