python - PyAutoGUI 无法导入 pyscreeze

标签 python python-3.x python-imaging-library pyautogui pyscreeze

我的代码:

import pyautogui
from time import sleep
x, y = pyautogui.locateOnScreen("slorixsh.png", confidence=0.5)

错误:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    x, y = pyautogui.locateOnScreen("slorixsh.png", confidence=0.5)
  File "C:\Users\mrnug\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 231, in _couldNotImportPyScreeze
    raise PyAutoGUIException(
pyautogui.PyAutoGUIException: PyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call.

该错误中的第 231 行:

 raise PyAutoGUIException(
            "PyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call."
        )

不知怎的,它不起作用 我刚刚重新安装并更新了该模块:

pyscreeze, opencv, pyautogui, pillow

最佳答案

是的,你可以通过这个解决它

pip 安装 pyscreeze

import pyscreeze
import time

time.sleep(5)
x, y = pyscreeze.locateOnScreen("slorixsh.png", confidence=0.5)

关于python - PyAutoGUI 无法导入 pyscreeze,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73925578/

相关文章:

python - MacOS 上的 Tkinter Python 3 缩放问题

python - 在从另一个用 C 实现的类驱动的类上使用元类

Python库安装

python - 使用 Tkinter 显示一系列 PIL 图像

python - 如何使用 python 从 csv 文件中读取特定范围的行?

python - 使用 Gym 训练神经网络

python - 当列大于 0 时,如何对重置为 0 的列进行求和?

php - 如何逐字节发送/接收数据

python - 搜索从某个前缀开始的列表元素的函数的 O(n) 难度是多少?

python - 使用 Python PIL 和 Windows API : how to deal with rounded corners? 的事件窗口屏幕截图