pyautogui,截图功能无法识别已安装的 Pillow 模块

Sve*_*ito 5 python importerror pillow pyautogui

我想在 Pycharm 中执行这段代码

x, y = pyautogui.locateCenterOnScreen('LVL35.png')
Run Code Online (Sandbox Code Playgroud)

但我收到这条消息

ImportError: Pillow module must be installed to use screenshot functions on Windows.
Run Code Online (Sandbox Code Playgroud)

问题是,我使用 anaconda 并且已经安装了 Pillow,我也可以在 Project Interpreter 设置中找到它。

Requirement already satisfied: Pillow in c:\anaconda3\lib\site-packages (4.2.1)
Run Code Online (Sandbox Code Playgroud)

任何的想法?

在此处输入图片说明

Sve*_*ito 10

That's almost a bit embarassing, but in case anyone of you has the same problem, just update your Pillow package.

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

Pillow-4.2.1 was on my system, it upgraded to Pillow-5.1.0 and now everything works just fine.