python - 尽管安装了所需的库(在 ubuntu 上使用 python3),但 Pyautogui 函数 LocateOnScreen 仍然出错。请帮帮我

标签 python python-3.x ubuntu pyautogui

解释器中使用的函数:

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/

相关文章:

python - 自动化处理警报

javascript - Python 中 crypto.getRandomValues 和 Uint32Array 的等效项

ubuntu - 在 Ubuntu 14.10 中构建 RethinkDb 服务器会导致错误

python - 如何获取子类(class)的名称?

python - TensorFlow vs PyTorch 卷积混淆

python - pandas 获取具有特定值的行的列平均值?

python - 在循环中创建子列表

python - 如何将 Python virtualenv 移动到不同的系统(计算机)并使用站点包中存在的包

Cat 命令无法与 execvp 一起正常工作

python - 在 Linux [UBUNTU, Python] 中连接 PPTP-VPN