0

由于某种原因,我在屏幕上找不到,错误看起来像这样;

    Traceback (most recent call last):
  File "C:\Users\centr\PycharmProjects\phoenix\whatsapp\main.py", line 7, in <module>
    position1 = pt.locateOnScreen('whatsapp/smiley_paperclip.png')
  File "C:\Users\centr\PycharmProjects\phoenix\venv\lib\site-packages\pyautogui\_init_.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\centr\PycharmProjects\phoenix\venv\lib\site-packages\pyautogui\_init_.py", line 213, in locateOnScreen
    return pyscreeze.locateOnScreen(*args, **kwargs)
  File "C:\Users\centr\PycharmProjects\phoenix\venv\lib\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 "C:\Users\centr\PycharmProjects\phoenix\venv\lib\site-packages\pyscreeze\_init_.py", line 143, in wrapper
    raise PyScreezeException('The Pillow package is required to use this function.')
pyscreeze.PyScreezeException: The Pillow package is required to use this function.

如果我尝试安装 Pillow,它表明已经安装并且错误仍然存​​在。

我通过卸载枕头 8.3.0 并安装枕头 8.0.0 来修复它。

4

1 回答 1

1

好问题!你需要做的是升级枕头。这将阻止错误发生。请按照下列步骤操作:

  1. 首先,在 Windows 上打开命令提示符。为此,请单击 Windows 键并键入:“cmd”。这将打开一个 Windows 终端,允许您修复 Pillow。

  2. 打开命令提示符后,准确输入:

pip install Pillow --upgrade

这应该执行一个命令来升级 Pillow 并阻止 Pyautogui 再次出现此错误。

就是这样!Pyautogui 不应显示此错误。

于 2021-07-05T21:01:01.373 回答