Using Python 3.9 and uninstalling an older version of PIL and replacing with the most current version
Solution 1:
Ubuntu 20.04 and later has the python3.9 package in its default repositories. It can be installed by sudo apt update && sudo apt install python3.9
and then install PIL with sudo apt install python3-pil
. Installing both of these packages from the default Ubuntu repositories simplifies package management.
If you are using Ubuntu 20.04 keep Python 3.8 as the default Python 3.x version and switch to Python 3.9 only when necessary using update-alternatives
. After you are done using Python 3.9 you can switch the it back to the default Python 3 version.
-
List installed versions of Python:
update-alternatives --list python
-
Switch between Python versions:
update-alternatives --config python
From the terminal command-line Press <enter> to keep the current choice[*], or type selection number:
Getting the latest version of PIL working in Ubuntu 18.04 is more convoluted. Please comment if you are using Ubuntu 18.04 and I'll revise this answer. If you are using Ubuntu 18.04 I guess you want to install PIL with sudo pip3 install pil
, right?