Python PIL stopped working

Tried to run an old working program that displayed images. But got errors saying the img.show() type was none or nonetype. But obviously it wasn’t because the prints below worked.

So googled and found the simplest 3 line example (I added the 2 prints)…

from PIL import Image
im = Image.open(“/home/bill/Pictures/Computers/H11.png”)
print(“Type is”,type(im))
print(im.format, im.size, im.mode)
im.show()

So for the heck of it I installed a virtual environment and did a…
pip install Pillow

And it worked.

However pillow was version 9.4.0 and the default installed version was 7.0.0

So did…

pip uninstall pillow (which failed)
sudo pip uninstall pillow (which failed)
sudo pip install –upgrade pip
sudo pip uninstall pillow (which removed version 7)
sudo pip install pillow (installed version 9.4.0)