Python Forum

Full Version: Python Image Library Help Raspian Raspberry Pi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm sorry this is a basic question, I've combed the internet following multiple tutorial/forum posts regarding this issue and I'm no further forward.

I wish to import a jpg into a Tkinter gui using the PIL as many tutorials have pointed out.

I have a clean install of Raspbian, I couldn't find Python on it so I followed a tutorial to install Python 3.8.2. When trying to execute a script with " from PIL import Image, ImageTk " in it, I get the python IDLE message:

Error:
Traceback (most recent call last): File "/home/pi/Desktop/gui_test.py", line 10, in <module> from PIL import Image, ImageTk ModuleNotFoundError: No module named 'PIL'
So PIL is not installed.... Using the Pi Terminal and the command "sudo pip install pil" I get the message:

Error:
sudo pip install pil Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting pil Could not find a version that satisfies the requirement pil (from versions: ) No matching distribution found for pil
So then I read that PIL is no longer supported and I should use Image? When trying to install this:

[Image: TkbLY7T]

It has references to python 2.7? Disregarding that, I use the python code "import image" and the error (in the picture) shows in the python idle. So it seems image has been saved to python 2.7??

Please help me to rectify this issue! thank you in advance!
PIL is now called pillow

sudo pip install pillow
As far back as I can remember the package was always named pillow.
this is the reason that I always name the main class same as package name.
Thanks Guys, it comes up with:

Error:
pi@raspberrypi:~ $ sudo pip install pillow Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pillow in /usr/lib/python2.7/dist-packages (5.4.1)
obviously thinks Python 2.7 is installed but I cant seem to uninstall it!

Error:
pi@raspberrypi:~ $ sudo pip uninstall python2.7 Skipping python2.7 as it is not installed.
your environment variables are pointing to python 2.7
python 3 is probably installed but not properly.
best to remove and reinstall.
use: https://python-forum.io/Thread-Part-1-Li...nvironment