How to remove Python 3.6 from Ubuntu?
I just installed Ubuntu, and it comes with default a default Python version of 3.6.7. I installed Python 3.7.3 by following these instructions (changing 3.7.2 to 3.7.3 as appropriate) and it all worked well.
Now I have two Python 3 versions, both working. I would now like to remove Python 3.6.7 and keep 3.7.3.
How should I go about doing this?
Solution 1:
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.
Solution 2:
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.