我现在使用的是来自"用Python自动化无聊的东西"的pyautogui模块.我的代码一直告诉我py


import pyautogui
wh = pyautogui.size()
print(wh)

输出:

locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__
AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'

请允许我感谢你的帮助。

pyscreezeinit.py文件中缺少

locationOnWindows方法,您可以从下面的链接中获得更新的代码,只需将代码复制并传递到pyscreezeinit.my文件中,希望这个问题能在中得到解决

https://github.com/asweigart/pyscreeze/blob/master/pyscreeze/init.py#L418

I删除pyautoguipyscreeze,然后它对我有效。

要删除,请首先找到pyautogui的安装位置。使用此命令在您的机器上定位pyautogui:

pip show pyautogui

然后复制位置。

我的位置是:

c:usersnitro 5appdatalocalprogramspythonpython38libsite-packages

删除Pyautogui和pyscreeze。

安装pyautogui:

pip install pyautogui

尝试从github更改C:\Users\User\AppData\Local\Programs\Python310\Lib\site packages\pyscreeze中的init.py:https://github.com/asweigart/pyscreeze/blob/master/pyscreeze/__init__.py

我也遇到过完全相同的问题。我真正要做的就是安装Pyscreeze库的新版本。正如你从这个链接中看到的https://github.com/asweigart/pyscreeze/commit/9edb5d70fbe3b3ee2f2cb710f25401b893d51dfc他们在0.1.27的版本中添加了locateWinDow((函数。就我而言,我有0.13.26版本的Pyscreeze。在我安装了新版本的库之后,一切都开始正常工作。

我遇到了同样的问题,并用方法解决了它

pip install --upgrade pyscreeze 

最新更新