1

Like stated in this question, my system broke too, when i tried to remove multiple versions of python installed. I now want to keep only one installation, that is the latest one, and also to be able to not have confusions making virtual envs and to install packages to always a single python version and not deal with legacy and lot more reasons. I want to retain only one python version, which is python 3.9. How do I do this without breaking my system?

This is how many python versions I have installed on my 20.04 ubuntu 64-bit desktop.

naveen@naveen-hp:~$ whereis python3
python3: /usr/bin/python3 /usr/bin/python3.8 /usr/bin/python3.9 /usr/lib/python3 /usr/lib/python3.8 /usr/lib/python3.9 /etc/python3 /etc/python3.8 /etc/python3.9 /usr/local/lib/python3.8 /usr/local/lib/python3.9 /usr/include/python3.8 /usr/share/python3 /usr/share/man/man1/python3.1.gz
naveen@naveen-hp:~$ whereis python
python: /usr/bin/python3.8 /usr/bin/python3.9 /usr/lib/python3.8 /usr/lib/python3.9 /usr/lib/python2.7 /etc/python3.8 /etc/python3.9 /usr/local/lib/python3.8 /usr/local/lib/python3.9 /usr/include/python3.8
  • You break your system if you remove the default python. It used to be so broken, reinstall was the only alternative. All your software that uses python to support system specifically has dependancy on default installed version. You would have to recompile your entire system. Do not uninstall default python. You just have to manage which python you use in your commands. – oldfred Oct 07 '20 at 14:10
  • So, there's no way I can retain only one python version, then!!. hmm. – Naveen Reddy Marthala Oct 07 '20 at 14:11

1 Answers1

1

Short answer you cannot.

There are several reasons, e.g. that different Python versions are not backwards compatible. E.g. Python 3.9 has changed some APIs, so code which ran on Python 3.8 does not necessarily run on Python 3.9.

And the pre-installed Python interpreter is necessary to run system code. E.g. apt, your package installer, is written in Python.

So, please don't even try :-)

Jürgen Gmach
  • 695
  • 5
  • 12