uninstall python in ubuntu

How to Uninstall Python in Ubuntu

Python is installed by default in every Ubuntu distribution. Different Ubuntu versions contain different python versions. For example, Ubuntu 18.04 contains python 3.6 while Ubuntu 20.04 contains python 3.8. You may also install other python versions in Ubuntu, apart from the default installation. However, sometimes you may need to remove python from Ubuntu. In this article, we will look at how to uninstall python in Ubuntu.


How to Uninstall Python in Ubuntu

Here are the steps to uninstall python in Ubuntu. Please note, it is not recommended to remove python from Ubuntu. It may cause some of your existing applications to stop working.


1. Purge Default Python

Open terminal and run the following command to delete default python from your system. Here is the command to remove python 2.x (e.g. python 2.7) from your system. If you want to remove python 3.x, replace 2.x below with 3.x.

sudo apt purge python2.x-minimal


2. Remove symbolic link

Run the following command to remove the symbolic link to the above python file. For python 3.x, replace 2.x with 3.x below.

sudo ln -s /usr/bin/python2.x /usr/bin/python

That’s it. In this article, we have learnt how to remove python from Ubuntu.

Also read:

How to Convert JSON to Dict in Python
How to Install NTP in RHEL/CentOS
How to Enable & Disable Root User in Linux
How to Check RAM Size in Linux
How to Disable SELinux in CentOS

One thought on “How to Uninstall Python in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *