PyAutoGUI 无法导入 pyscreeze

问题描述 投票:0回答:2

我的代码:

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
python python-3.x python-imaging-library pyautogui pyscreeze
2个回答
2
投票

是的,你可以用这个解决它

pip install pyscreeze

import pyscreeze
import time

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

0
投票

可能是pyautogui和pillow不兼容造成的。 只需尝试安装不同版本的枕头即可。

© www.soinside.com 2019 - 2024. All rights reserved.