你好,所以我想在python中创建一个脚本,它可以立即接受我的游戏。我使用空闲SHELL执行以下操作:
import pyautogui
import os
**butt=pyautogui.locateCenterOnScreen('C:\\Users\\dariu\\Desktop\\autoclicker\\button.png', minSearchTime=2000)**
pyautogui.moveTo(butt)
pyautogui.click(butt)
pyautogui.click(butt)在粗体代码行之后,我得到了以下错误:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
butt=pyautogui.locateCenterOnScreen('C:\\Users\\dariu\\Desktop\\autoclicker\\button.png', minSearchTime=2000)
File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 207, in locateCenterOnScreen
return pyscreeze.locateCenterOnScreen(*args, **kwargs)
File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
coords = locateOnScreen(image, **kwargs)
File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 372, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "C:\Users\dariu\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 144, in wrapper
raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.发布于 2022-02-16 22:01:44
看起来,需要枕头包才能使用其中的一个包。检查跟踪错误的最后一行
在粗体行之前导入此代码:链接到枕头PyPI
https://stackoverflow.com/questions/71149481
复制相似问题