1

I had Ubuntu 16.04, and once mistakenly tried to remove Python 3.5.2, but it caused a lot of harm and I had to reinstall many things.

Now, I have upgraded to 20.04, in which the default Python is 3.8.2. Can I remove the 3.5.2 version with no harm?

What about version 2.7.18 - it is still installed - can I remove it?

2

Certainly Ubuntu 20.04 does not need the older versions of Python you mentioned, but you may have scripts of your own that might have "wired-in" a default interpreter (#!/usr/bin/python etc.).

| improve this answer | |
2

You should not have 2.7 or 3.6 unless you installed them or some app you installed added them. I held back several apps that wanted to install, so only have default python.

fred@Z170N-focal:~$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root       9 Mar 13 08:20 /usr/bin/python3 -> python3.8
-rwxr-xr-x 1 root root 5457536 Apr 27 11:53 /usr/bin/python3.8
lrwxrwxrwx 1 root root      33 Apr 27 11:53 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root      16 Mar 13 08:20 /usr/bin/python3-config -> python3.8-config
-rwxr-xr-x 1 root root     384 Mar 27 22:39 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     388 Mar 27 22:39 /usr/bin/python3-pasteurize
| improve this answer | |
1

here is my heavily used Ubuntu 20.04 which was directly installed not an upgrade

ls -l /usr/bin/python*
lrwxrwxrwx 1 root root       9 Mar 13 08:31 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3694632 Apr  7 08:05 /usr/bin/python2.7
lrwxrwxrwx 1 root root      33 Apr  7 08:05 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root      16 Mar 13 08:31 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root       9 Mar 13 08:20 /usr/bin/python3 -> python3.8
-rwxr-xr-x 1 root root 5457536 Apr 27 11:53 /usr/bin/python3.8
lrwxrwxrwx 1 root root      33 Apr 27 11:53 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root      16 Mar 13 08:20 /usr/bin/python3-config -> python3.8-config
-rwxr-xr-x 1 root root     384 Mar 27 22:39 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     388 Mar 27 22:39 /usr/bin/python3-pasteurize

this shows the 2.7 packages

dpkg -l|grep  python2.7

after purging my python2.7 packages -> reboot -> all is well so I would say go ahead and zap at will

be aware that manually installed code which does not install using ubuntu packages yet relies on 2.7 will be orphaned

| improve this answer | |
0

Python is used in a lot of system scripts. So I'd leave all python 3 modules untouched. Python 2 however is not supported anymore. So you could remove the python2 - but it will disable you to try and test some older scripts you may want to pickup in the future...

On current Ubuntu 20.04 python2 is not installed. (They may hide in snap)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.