Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyautogui, screenshot function doesn't recognize installed Pillow module

I want to execute this code in Pycharm

x, y = pyautogui.locateCenterOnScreen('LVL35.png')

But I get this message

ImportError: Pillow module must be installed to use screenshot functions on Windows.

The thing is, I use anaconda and Pillow is already installed and I can also find it in the Project Interpreter settings.

Requirement already satisfied: Pillow in c:\anaconda3\lib\site-packages (4.2.1)

Any idea?

enter image description here

like image 391
Svenno Nito Avatar asked Jun 10 '18 08:06

Svenno Nito


People also ask

How do I import a python pillow?

To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).

What is PyScreeze?

PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3.

How do I take a screenshot in pyautogui?

Code For Screenshot Using PyAutoGUI 1 First of all import pyautogui module. 2 Then create a variable (file) that will store the screenshot. 3 screenshot ( ) method will take screenshot of your screen. 4 Now save this image by calling save ( ) method. You have to pass name of screenshot to the save ( ) function.

How to install pyautogui module in Python?

To install PyAutoGUI module, you have to run following code on your command prompt. screenshot ( ) method of pyautogui class is used to take screenshot of your screen. Now write the following code on your python IDE.

Is pillow Module required to use screenshot functions on Windows?

ImportError: Pillow module must be installed to use screenshot functions on Windows. The thing is, I use anaconda and Pillow is already installed and I can also find it in the Project Interpreter settings. Any idea? What's OS you are using Linux /Windows , For Linux you need to have scrot installed , For windows there is no dependency .

How to take a screenshot in Python pillow?

In this tutorial, we will introduce using python pillow library to take a screenshot for python beginners. We will use ImageGrab model to take a screenshot. In this tutorial, we will take a image 250 * 250. In order to set bbox correctly, you can read this tutorial. We will use ImageGrab.grab () function to get a snapshot of the screen.


1 Answers

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

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

like image 176
Svenno Nito Avatar answered Sep 22 '22 00:09

Svenno Nito