Pyautogui错误:需要Pillow包才能使用此功能

5 python python-imaging-library pyautogui

当我这样做时,我的 pyautogui 程序给出以下错误:

position = pyautogui.locateCenterOnScreen(image, confidence=.7)

错误信息:

File "C:\Users\ashis\AppData\Local\Programs\Python\Python39\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.
Run Code Online (Sandbox Code Playgroud)

pyautogui.locateCenterOnScreen()仅当我给出错误时,其他 pyautogui 函数才能正常工作。

我已经正确安装了枕头:

Requirement already satisfied: pillow in c:\users\ashis\appdata\local\programs\python\python310\lib\site-packages (9.0.0)
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?我正在遵循教程。

Tan*_*nay 9

这是一个小问题,只需更新你的 Pillow 包即可。

pip install Pillow --upgrade
Run Code Online (Sandbox Code Playgroud)

我的系统上有 Pillow-4.2.1,它升级到 Pillow-5.1.0,现在一切正常。