[英]Am using the pyautogui module now from Automate the Boring Stuff With Python. My code keeps telling me pyscreeze has no attribute locateOnWindow
import pyautogui
wh = pyautogui.size()
print(wh)
output:
locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__
AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'
請我將不勝感激您的幫助。
pyscreez init .py 文件中缺少 locatOnWindows 方法,您可以從下面的鏈接獲取更新的代碼,只需將代碼復制並粘貼到 pyscreez init .py 文件中,希望此問題將得到解決
https://github.com/asweigart/pyscreez/blob/master/pyscreeeze/init .py# L418
我刪除了 pyautogui和pyscreez ,然后它對我有用。
刪除 首先找到 pyautogui 的安裝位置。 使用此命令在您的機器上找到 pyautogui:
pip show pyautogui
然后復制位置。
我的位置是:
c:\users\nitro 5\appdata\local\programs\python\python38\lib\site-packages
刪除 Pyautogui 和 pyscreez。
安裝 pyautogui:
pip install pyautogui
嘗試從 github 更改 C:\Users\User\AppData\Local\Programs\Python\Python310\Lib\site-packages\pyscreez 中的init .py: https ://github.com/asweigart/pyscreeeze/blob/master/ pyscreez/__init__.py
我也有完全相同的問題。 我真正需要做的就是安裝更新版本的 Pyscreez 庫。 正如您從該鏈接https://github.com/asweigart/pyscreez/commit/9edb5d70fbe3b3ee2f2cb710f25401b893d51dfc中看到的那樣,他們在 0.1.27 版本中添加了 locateOnWindow() 函數。 至於我,我有0.1.26版本的 Pyscreez。 在我安裝了更新版本的庫之后,一切都開始正常工作了。
我有同樣的問題並用這種方法解決了
pip 安裝--升級 pyscreez
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.