Score:0

Using Python 3.9 and uninstalling an older version of PIL and replacing with the most current version

us flag

I have downloaded Python 3.9 and the latest version of PIP or so I thought. I am trying to work with PIL, but I keep getting invalid syntax error. I did some research to uninstall PIL and reinstall with the latest, but something must have changed with the newest versions, because every suggestion I read and tried didn't work.

guiverc avatar
cn flag
Please start with your OS & release details.
karel avatar
sa flag
@guiverc chuck lee is a new contributor so it's likely that he is using Ubuntu 20.04, 21.04 or 21.10, all of which are "vanilla" versions with respect to my answer.
guiverc avatar
cn flag
I agree @karel, but I don't know how to respond. FYI: the close-vote wasn't me; I commented my 2c & moved on..
Score:1
sa flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.