解释器中使用的函数:
pyautogui.locateOnScreen('zoom_pic.png')
错误是:-Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
pyautogui.locateOnScreen('zoom_pic.png')
File "/home/aaryan/.local/lib/python3.8/site-packages/pyautogui/__init__.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "/home/aaryan/.local/lib/python3.8/site-packages/pyautogui/__init__.py", line 213, in locateOnScreen
return pyscreeze.locateOnScreen(*args, **kwargs)
File "/home/aaryan/.local/lib/python3.8/site-packages/pyscreeze/__init__.py", line 371, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "/home/aaryan/.local/lib/python3.8/site-packages/pyscreeze/__init__.py", line 498, in _screenshot_linux
raise NotImplementedError('"scrot" must be installed to use screenshot functions in Linux. Run: sudo apt-get install scrot')
NotImplementedError: "scrot" must be installed to use screenshot functions in Linux. Run: sudo apt-get install scrot
最佳答案
错误消息说:
"scrot" must be installed to use screenshot functions in Linux. Run: sudo apt-get install scrot
你试过sudo apt-get install scrot
在你的终端?这应该允许你运行像 pyautogui.locateOnScreen()
这样的函数。和 pyautogui.screenshot()
.
关于python - 尽管安装了所需的库(在 ubuntu 上使用 python3),但 Pyautogui 函数 LocateOnScreen 仍然出错。请帮帮我,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68037482/