How to remove Python 3.6 from Ubuntu?

16,841

Solution 1

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.

Solution 2

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.

Share:
16,841

Related videos on Youtube

User19
Author by

User19

Updated on September 18, 2022

Comments

  • User19
    User19 almost 2 years

    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?

  • User19
    User19 about 5 years
    can you give me example of using pip3.7 that will work i.e pip3.7 install requests --user ??