How to Uninstall Python in Ubuntu 22.04

How to Uninstall Python in Ubuntu 22.04

Python is one of the most popular programming languages. It’s an interpreted general-purpose programming language with an emphasis on simplicity. Because of its versatility, Python is used for various purposes: web development, data analysis, artificial intelligence, and much more.

In this guide, we will have a look at uninstalling Python in Ubuntu 22.04.


To follow this guide, you need the following components:

Python Major Releases

As of now, the two major versions of Python are:

  • Python 2
  • Python 3

Python 2 received its last update (v2.7.18) on April 20, 2020. It’s been mostly phased out in favor of Python 3. This move, however, caused a major uproar in the community. Python 2 was so popular that the EOL had to be pushed multiple times into the future.

Although deprecated, you may still come across some Python 2 installations for compatibility reasons. By default, Ubuntu comes with installed Python 3.

Method 1: Removing Python Using APT

Step 1: Finding the Installed Python Package

Run the following commands:

$ python3 --version

$ python2 --version


  • We ask the Python executable to print its version.
  • Ubuntu 22.04 comes with pre-installed Python 3. So, the first command returns a version number.
  • Ubuntu 22.04 doesn’t come with pre-installed Python 2. So, the expected result is an error. However, if the command returns a version number, Python 2 is later installed.

On Debian/Ubuntu, the core Python packages are as follows:

  • Python 2: python2
$ apt info python2

  • Python 3: python3
$ apt info python3

Step 2: Uninstalling Python

Now that we know what Python version is currently installed on the system, we can start to work on uninstalling them.

To remove Python 2, run the following command:

$ sudo apt remove python2

To remove Python 3, run the following command:

$ sudo apt remove python3

Optional: Remove All Python Packages

Removing all the Python-related packages is generally not recommended since various parts of the system depend on them. If you wish to proceed, ensure that you backed up all your important data.

To remove all the Python packages from the system, run the following command:

$ sudo apt autoremove --purge *python*


  • The APT package manager looks for packages that match the given regular expression (*python*). The matching packages are marked for removal.
  • APT also marks the dependencies of those packages for removal.

Method 2: Removing Python from the Source

If Python was compiled and installed from its source code, APT won’t be able to recognize the installation. In that case, the uninstallation process will be different.

Assuming you still have the source directory which contains the compiled Python package, run the following commands:

$ cd <path_to_python_source_dir>
$ sudo make uninstall

If you removed the source directory, you could try removing the installed libraries and binaries manually:

$ cd /usr/local/bin
$ sudo rm -f 2to3* idle* pip* pydoc* python*

Note that this is meant to be the last resort. It may lead to corrupted and broken configurations throughout the system.

Method 3: Removing PyPy

PyPy aims to be a replacement for CPython (the default Python implementation). It’s built with RPython which was simultaneously developed with it. The key advantage to using PyPy other than CPython is performance. Although it’s an implementation of Python, certain differences can impact compatibility. Learn more about PyPy.

Similar to the classic Python, PyPy also has two major releases:

  • PyPy 2 (pypy)
  • PyPy 3 (pypy3)

To install PyPy, run the following commands:

$ sudo apt install pypy

sudo apt install pypy3

Similarly, to uninstall PyPy, run the following commands:

$ sudo apt remove pypy

$ sudo apt remove pypy3

Bonus: Removing PIP

PIP is the de-facto standard package manager for Python packages/modules. By default, it’s configured to use the Python Package Index as the source of packages. Starting from Python 3 (v3.4 and later), PIP comes pre-installed with Python 3. The term “PIP” is a recursive acronym for “PIP Installs Packages”. Learn more about PIP.

Similar to the Python major releases, PIP has unique versions for both Python 2 (python-pip) and Python 3 (python3-pip).

$ apt info python-pip

apt info python3-pip

If you removed all the Python packages, PIP is also uninstalled by default. However, if you desire to specifically uninstall PIP, run the following commands:

$ sudo apt remove python-pip

sudo apt remove python3-pip


We demonstrated the multiple ways of removing Python from Ubuntu 22.04. We demonstrated uninstalling both CPython and PyPy from the system using APT. We also discussed uninstalling Python if it is installed from the source code.

Need to reinstall Python? Check out this guide on installing Python on Ubuntu 22.04. Interested in starting your journey with Python? The following guide features 30 example scripts to get started. The Python sub-category also contains numerous guides on various aspects of Python programming.

Original article source at:

#ubuntu #python 

What is GEEK

Buddha Community

How to Uninstall Python in Ubuntu 22.04
Shardul Bhatt

Shardul Bhatt


Why use Python for Software Development

No programming language is pretty much as diverse as Python. It enables building cutting edge applications effortlessly. Developers are as yet investigating the full capability of end-to-end Python development services in various areas. 

By areas, we mean FinTech, HealthTech, InsureTech, Cybersecurity, and that's just the beginning. These are New Economy areas, and Python has the ability to serve every one of them. The vast majority of them require massive computational abilities. Python's code is dynamic and powerful - equipped for taking care of the heavy traffic and substantial algorithmic capacities. 

Programming advancement is multidimensional today. Endeavor programming requires an intelligent application with AI and ML capacities. Shopper based applications require information examination to convey a superior client experience. Netflix, Trello, and Amazon are genuine instances of such applications. Python assists with building them effortlessly. 

5 Reasons to Utilize Python for Programming Web Apps 

Python can do such numerous things that developers can't discover enough reasons to admire it. Python application development isn't restricted to web and enterprise applications. It is exceptionally adaptable and superb for a wide range of uses.

Robust frameworks 

Python is known for its tools and frameworks. There's a structure for everything. Django is helpful for building web applications, venture applications, logical applications, and mathematical processing. Flask is another web improvement framework with no conditions. 

Web2Py, CherryPy, and Falcon offer incredible capabilities to customize Python development services. A large portion of them are open-source frameworks that allow quick turn of events. 

Simple to read and compose 

Python has an improved sentence structure - one that is like the English language. New engineers for Python can undoubtedly understand where they stand in the development process. The simplicity of composing allows quick application building. 

The motivation behind building Python, as said by its maker Guido Van Rossum, was to empower even beginner engineers to comprehend the programming language. The simple coding likewise permits developers to roll out speedy improvements without getting confused by pointless subtleties. 

Utilized by the best 

Alright - Python isn't simply one more programming language. It should have something, which is the reason the business giants use it. Furthermore, that too for different purposes. Developers at Google use Python to assemble framework organization systems, parallel information pusher, code audit, testing and QA, and substantially more. Netflix utilizes Python web development services for its recommendation algorithm and media player. 

Massive community support 

Python has a steadily developing community that offers enormous help. From amateurs to specialists, there's everybody. There are a lot of instructional exercises, documentation, and guides accessible for Python web development solutions. 

Today, numerous universities start with Python, adding to the quantity of individuals in the community. Frequently, Python designers team up on various tasks and help each other with algorithmic, utilitarian, and application critical thinking. 

Progressive applications 

Python is the greatest supporter of data science, Machine Learning, and Artificial Intelligence at any enterprise software development company. Its utilization cases in cutting edge applications are the most compelling motivation for its prosperity. Python is the second most well known tool after R for data analytics.

The simplicity of getting sorted out, overseeing, and visualizing information through unique libraries makes it ideal for data based applications. TensorFlow for neural networks and OpenCV for computer vision are two of Python's most well known use cases for Machine learning applications.


Thinking about the advances in programming and innovation, Python is a YES for an assorted scope of utilizations. Game development, web application development services, GUI advancement, ML and AI improvement, Enterprise and customer applications - every one of them uses Python to its full potential. 

The disadvantages of Python web improvement arrangements are regularly disregarded by developers and organizations because of the advantages it gives. They focus on quality over speed and performance over blunders. That is the reason it's a good idea to utilize Python for building the applications of the future.

#python development services #python development company #python app development #python development #python in web development #python software development

How to Install Pyenv on Ubuntu 18.04

What is Pyenv?
Pyenv is a fantastic tool for installing and managing multiple Python versions. It enables a developer to quickly gain access to newer versions of Python and keeps the system clean and free of unnecessary package bloat. It also offers the ability to quickly switch from one version of Python to another, as well as specify the version of Python a given project uses and can automatically switch to that version. This tutorial covers how to install pyenv on Ubuntu 18.04.

#tutorials #apt #debian #environment #git #github #linux #package #package management #package manager #personal package archive #ppa #pyenv #python #python 3 #python support #python-pip #repository #smb #software #source install #ubuntu #ubuntu 18.04 #venv #virtualenv #web application development

Chet  Lubowitz

Chet Lubowitz


How to Install Microsoft Teams on Ubuntu 20.04

Microsoft Teams is a communication platform used for Chat, Calling, Meetings, and Collaboration. Generally, it is used by companies and individuals working on projects. However, Microsoft Teams is available for macOS, Windows, and Linux operating systems available now.

In this tutorial, we will show you how to install Microsoft Teams on Ubuntu 20.04 machine. By default, Microsoft Teams package is not available in the Ubuntu default repository. However we will show you 2 methods to install Teams by downloading the Debian package from their official website, or by adding the Microsoft repository.

Install Microsoft Teams on Ubuntu 20.04

1./ Install Microsoft Teams using Debian installer file

01- First, navigate to teams app downloads page and grab the Debian binary installer. You can simply obtain the URL and pull the binary using wget;

$ wget${VERSION}_amd64.deb

#linux #ubuntu #install microsoft teams on ubuntu #install teams ubuntu #microsoft teams #teams #teams download ubuntu #teams install ubuntu #ubuntu install microsoft teams #uninstall teams ubuntu

Art  Lind

Art Lind


Python Tricks Every Developer Should Know

Python is awesome, it’s one of the easiest languages with simple and intuitive syntax but wait, have you ever thought that there might ways to write your python code simpler?

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

Let’s get started

Swapping value in Python

Instead of creating a temporary variable to hold the value of the one while swapping, you can do this instead

>>> FirstName = "kalebu"
>>> LastName = "Jordan"
>>> FirstName, LastName = LastName, FirstName 
>>> print(FirstName, LastName)
('Jordan', 'kalebu')

#python #python-programming #python3 #python-tutorials #learn-python #python-tips #python-skills #python-development

Art  Lind

Art Lind


How to Remove all Duplicate Files on your Drive via Python

Today you’re going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates.


In many situations you may find yourself having duplicates files on your disk and but when it comes to tracking and checking them manually it can tedious.

Heres a solution

Instead of tracking throughout your disk to see if there is a duplicate, you can automate the process using coding, by writing a program to recursively track through the disk and remove all the found duplicates and that’s what this article is about.

But How do we do it?

If we were to read the whole file and then compare it to the rest of the files recursively through the given directory it will take a very long time, then how do we do it?

The answer is hashing, with hashing can generate a given string of letters and numbers which act as the identity of a given file and if we find any other file with the same identity we gonna delete it.

There’s a variety of hashing algorithms out there such as

  • md5
  • sha1
  • sha224, sha256, sha384 and sha512

#python-programming #python-tutorials #learn-python #python-project #python3 #python #python-skills #python-tips