简体   繁体   中英

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'

Please I will be grateful for your Help.

locatOnWindows method is missing from pyscreeze init .py file, you can get the updated code from link below, just copy and past the code to pyscreeze init .py file and hopefully this issue will be resolved

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

I deleted pyautogui and pyscreeze , then it worked for me.

To delete First locate where pyautogui is installed. Use this command to locate pyautogui on your machine:

 pip show pyautogui

Then copy location.

My location was:

c:\users\nitro 5\appdata\local\programs\python\python38\lib\site-packages

Delete Pyautogui and pyscreeze.

Install 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

I have also had the exact same issue. All that I really had to do was to install the newer version of the Pyscreeze library. As you can see from this link https://github.com/asweigart/pyscreeze/commit/9edb5d70fbe3b3ee2f2cb710f25401b893d51dfc they've added the locateOnWindow() function in the version of 0.1.27. As for my part, I'd had the Pyscreeze of 0.1.26 version. After I'd had installed the newer version of the library everything started working just fine.

I had the same problem and solved it with this method

pip install --upgrade pyscreeze

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM