我正在编写一个机器人与浏览器交互(不要说服我重写Selenium或键盘和其他),它给了我一个错误。附近没有名为pyautogui的文件,我试着将其命名为main和python v3.8,3.9。在每种情况下都收到此错误。MacOS
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/rubicon/objc/ctypes_patch.py:21: UserWarning: rubicon.objc.ctypes_patch has only been tested with Python 3.4 through 3.8. You are using Python 3.9.4. Most likely things will work properly, but you may experience crashes if Python's internals have changed significantly.
warnings.warn(
Traceback (most recent call last):
File "/Users/alina/PycharmProjects/ABOBA/main_miner_alienworlds.py", line 183, in <module>
for i in pyautogui.getWindowsWithTitle('##### #######'):
AttributeError: module 'pyautogui' has no attribute 'getWindowsWithTitle'
个字符
pyautogui是用pip3安装的
3条答案
按热度按时间jum4pzuy1#
你用错模块了!
https://pypi.org/project/PyGetWindow/是包含
getWindowsWithTitle
的模块7vhp5slm2#
不幸的是,从0.9.53版本开始,pyautogui的windows功能只能在Windows上工作,请参阅下面的https://i.stack.imgur.com/HKtcC.png源代码:-https://automatetheboringstuff.com/2e/chapter20/
vyswwuz23#
对于macOS用户,您可能需要使用Quartz和AppKit。
一般来说,AppKit是内置的,因此您只需通过以下方式安装Quartz:
字符串
获取窗口信息:
型
你会看到这样的结果:
型