How to remove Python 3.6 from Ubuntu?

I installed python 3.7 and then:

sudo update-alternatives --config python3

See what is there, normally it will be an error, then:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

sudo update-alternatives --config python3

Choose 2 and you are done.


Ubuntu uses python for many system related functionalities. You must not remove the Python installation that is preinstalled by it, or you'll end up with a broken system, perhaps beyond repair.

If for some reason you need to use a more recent Python version, just install it parallel and call it explicitely, e. g. with python3.7, as python3 will point to the default installation. The same goes for pip, which may need the --user option or being called with sudo depending on the permissions.