首页 > 解决方案 > AttributeError:模块 'pyautogui' 没有属性 'size'

问题描述

作为Python的初学者,我真的不知道我在这里做错了什么?

我想与pyautogui

 >>> import pyautogui
 >>> pyautogui.PAUSE = 1
 >>> pyautogui.FAILSAFE = True
 >>> pyautogui.size()
 Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    pyautogui.size()
 AttributeError: module 'pyautogui' has no attribute 'size'

不知道为什么它不显示我的分辨率?通常,pyautogui 不适用于以下命令:

 >>> pyautogui.moveTo(100, 100, duration=0.25)
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    pyautogui.moveTo(100, 100, duration=0.25)
AttributeError: module 'pyautogui' has no attribute 'moveTo'
>>> 

我确定我安装了 pip。

标签: python

解决方案


Your own script which is named "pyautogui.py" is interfering with the module you installed — so rename it something else.


推荐阅读