Enter your email address below and subscribe to our newsletter

How to Uninstall Python in Ubuntu 22.04

Share your love

Python is mainly used for software development, automation, and data science. Since Python is one of the easiest programming languages to learn, it is always advised to go with Python as the first programming language.

From the launch of Ubuntu 22.04, you will only get Python 3.8 installed, and they are no longer shipping with Python2 because it was launched in 2000. If you want to uninstall Python from Ubuntu be it Python 3 or Python2 you can follow this tutorial

But before that, let’s have a look at what Python has to offer

What is Python? What makes it so special?

Python is an object-oriented high-level programming language. It is a dynamic and interpreted programming language that also supports procedural-oriented programming.

Being a dynamic programming language, you don’t have to declare the type of variable such as

A = 21

now, A can be used as String, Integer, and other applicable types

if you want an answer to what makes Python special, you have to go through its key features given below:

Ease of use: it is often recommended to beginners due to its lesser complex structure. Anyone determined to learn it can get a basic grasp in some days.

High-Level programming language: Being a high-level programming language, you don’t have to remember the system architecture or memory allocation during programming

Portable language: Python is a portable language means if you have written your code on a Windows machine, it can be run on any platform, such as Linux, without any changes.

Integrated language: Python is an integrated language because we can easily integrate Python with other programming languages such as C and C++.

Note: Removing Python from Ubuntu 20.04 can cause malfunctioning because many packages and tools heavily rely on Python. Have a complete backup of your system before precoding further.

Uninstalling Python from Ubuntu 20.04

We will show you how you can remove Python 2, Python 3, and Pip packages. So let’s start with removing Pip from our system.

Removing Pip from Ubuntu 20.04

Pip is a package manager for Python, which is similar to apt used on a daily basis to download and remove packages from Ubuntu. Using Pip, you can install required packages and Libraries. Open your Terminal and use the following command to remove Pip:

sudo apt-get remove python3-pip

 

uninstall python in ubuntu

If you want to remove Pip with all its dependencies, use the following command:

sudo apt-get remove --auto-remove python3-pip

 

2. sudo apt-get remove --auto-remove python3-pip

Now, if you want to remove Pip with its configuration and data, use the following command:

sudo apt-get purge python3-pip

 

3. sudo apt-get purge python3-pip

To remove configuration files, data, and dependencies completely, use the following command:

sudo apt-get purge --auto-remove python3-pip

 

4. sudo apt-get purge --auto-remove python3-pip

Removing Python 2 from Ubuntu 20.04

If you don’t need Python 2 installed on your system anymore, you can easily remove it by following commands:

sudo apt remove python2

 

1. sudo apt remove python2

If you want to remove dependencies of Python 2, use the following command:

sudo apt remove --auto-remove python2

 

2. sudo apt remove --auto-remove python2

If you want to remove Python 2 with all the configurations you have made, use the following command:

sudo apt purge python2

 

3. sudo apt purge python2

If you want to remove configuration files, data and dependencies included use the following command:

sudo apt purge --auto-remove python2

 

4. sudo apt purge --auto-remove python2

Removing Python 3 from Ubuntu 20.04

If you want to remove Python 3 due to some malfunctioning, you can follow the given commands:

sudo apt remove python3

 

1. sudo apt remove python3

If you are willing to remove Python 3 with all its dependencies included, use the given commands:

sudo apt remove --auto-remove python3

 

2. sudo apt remove --auto-remove python3

If you want to remove Python 3 with configurations you have made, use the following commands:

sudo apt purge python3

 

3. sudo apt purge python3

If you want to remove Python 3, including its dependencies, configuration, and data, use the following command:

 

sudo apt purge --auto-remove python3

 

4. sudo apt purge --auto-remove python3

Related Posts:

Wrapping up

This was our take on how to uninstall Python from Ubuntu. We have included everything from uninstalling Pip to both versions of Python. Remember to take backup while removing Python because there are major chances of malfunctioning.

Share your love
Sagar Sharma
Sagar Sharma

Sagar always uses Linux to its core and loves to write the technical side of system administration! While he's not writing for GeniusGeeks, you can find him writing for core linux blogs like IT'SFOSS.com and LinuxHandBook.com

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!