Score:3

Can I remove some python versions?

in flag

I have an older VM of Ubuntu that is running 16.04. On this system I have python3.5 and python3.8 installed. It seems that by default 'python' is being interpreted to mean python2.7 and python3 is set to python3.5. I would like the default to by 3.8, or at least the default python3 changed to python3.8? If I do this is it likely to break anything?

Should I actually delete python3.5? Is there any point in having multiple versions of python3?

Someone avatar
my flag
Ubuntu [16.04 LTS has reached the end of it's standard support life](https://help.ubuntu.com/community/EOL) thus is now off-topic here unless your question is specific to helping you move to a supported release of Ubuntu. See https://askubuntu.com/help/on-topic
Sadra Naddaf avatar
de flag
removing python3 from ubuntu ruins your day! Just Don't! Some apps including the terminal depend on it. try alternatives from the answer section.
Score:4
sa flag

Don't remove the default Python 3.x version because removing it can break a lot of things like the terminal, the Software app and many other apps. For more information see this question: Removed Python 3 and now Ubuntu Software Center, terminal and other applications don't work. The good news is that even if you break those things it is possible to restore the original Python 3.x version by booting Ubuntu into recovery mode, and then Ubuntu will work normally again.

Instead of replacing the default Python 3.x version entirely the recommended way of installing another Python 3.x version is to keep the existing Python 3 and install the new Python 3 version alongside it. Then you can use a program called update-alternatives to select which one of the Python versions you want to use.

Add Python 3.8 to update-alternatives so that you can switch between Python 3.5 and Python 3.8 by running update-alternatives --config python3.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8
update-alternatives --config python3

After you are done using Python 3.8 you can switch the it back to the default Python 3.5 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:

pLumo avatar
in flag
OP talks about 16.04 where 2.7 is the default which should not be removed. I guess it's safe to remove any 3.x version.
karel avatar
sa flag
Back in 13.04 removing Python 3 broke the Ubuntu Software Center, the terminal, and other applications - [link](https://askubuntu.com/questions/384033/).
jrh avatar
ph flag
jrh
I can say from past experience that messing with the executables that handle `python`, `python2` or `python3` is a very very bad idea. Years ago I (pretty foolishly) symlinked `python3` to `python`, apt quit working.
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.