Python Forum
Python Image Library Help Raspian Raspberry Pi
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Image Library Help Raspian Raspberry Pi
#1
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!
Reply
#2
PIL is now called pillow

sudo pip install pillow
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#3
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.
Reply
#4
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.
Reply
#5
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  video player inside a frame/panel in python raspberry pi desktop application MATHEWS 1 2,812 Dec-12-2018, 11:42 AM
Last Post: Larz60+
  wxPython install on raspberry pi3 and python 3.6.2. djdan_23 3 7,082 Sep-13-2017, 11:49 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020