How to completely uninstall python 2.7.13 on Ubuntu 16.04 How to completely uninstall python 2.7.13 on Ubuntu 16.04 python python

How to completely uninstall python 2.7.13 on Ubuntu 16.04


caution : It is not recommended to remove the default Python from Ubuntu, it may cause GDM(Graphical Display Manager, that provide graphical login capabilities) failed.

To completely uninstall Python2.x.x and everything depends on it. use this command:

sudo apt purge python2.x-minimal

As there are still a lot of packages that depend on Python2.x.x. So you should have a close look at the packages that apt wants to remove before you let it proceed.

Thanks, I hope it will be helpful for you.


How I do:

# Remove python2sudo apt purge -y python2.7-minimal# You already have Python3 but # don't care about the version sudo ln -s /usr/bin/python3 /usr/bin/python# Same for pipsudo apt install -y python3-pipsudo ln -s /usr/bin/pip3 /usr/bin/pip# Confirm the new version of Python: 3python --version


try following to see all instances of python

whereis pythonwhich python

Then remove all instances using:

sudo apt autoremove python

repeat sudo apt autoremove python(for all versions)that should do it, then install Anaconda and manage Pythons however you like if you need to reinstall it.