Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm 2021.1.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/T470/PycharmProjects/pythonProject/自动压枪.py", line 17, in <module> targetX += pg.randint(-50, 50) AttributeError: module 'pyautogui' has no attribute 'randint'
时间: 2023-08-29 07:08:39 浏览: 184
浅谈Python traceback的优雅处理
这个错误提示显示,在第17行代码中使用了`pyautogui`模块中不存在的`randint`属性。可能是您在代码中写错了`randint`的名称或者您的`pyautogui`模块版本较老,不支持`randint`属性。建议您检查代码的拼写和语法,并确保您的`pyautogui`模块已经正确安装且版本较新。您可以使用`pip install --upgrade pyautogui`命令来升级您的`pyautogui`模块。
阅读全文