Uninstall Python in Ubuntu

Uninstall Python in Ubuntu

  1. Check if Python Installed in Your System
  2. Ways to Remove/Uninstall Python in Ubuntu

This article demonstrates how to delete or uninstall Python from Ubuntu.

Check if Python Installed in Your System

  • Open the Terminal using Ctrl+Alt+T.
  • After opening the terminal, check whether your system has python installed or not by using the command python3 --version.
  • If the command replies with the specific version of python, then leave it because you have already installed python on your pc/desktop.
  • If the command replies with Command not found, then to install python, write the command sudo apt install python3.

There are many ways for its uninstallation depending upon a user’s needs. Different commands in the terminal do different tasks.

If there is only a need to delete specific dependencies related to a specific module of python or if there is a need to delete all the dependencies or to remove the Python3 package.

Depending upon the specific needs and requirements, the user can run the commands in the terminal for specific actions.

Ways to Remove/Uninstall Python in Ubuntu

Uninstall/Delete a Specific Version

Suppose a user wants to delete a specific version of Python installed on the Ubuntu machine. Run the below command and enter your user password. The version of Python will be removed from the machine.

Command:

sudo apt purge python<version>-minimal

Remove Only the python3 Package

If a user wants to remove the specific package of Python, i.e., python 3.5, run the below command and select and remove the python3 packages.

Command:

sudo apt-get remove python3.5

Remove Packages With Their Dependencies

Suppose you want to remove a package and all the dependencies related to that package, run the below-mentioned command, enter your ubuntu password, and the package will be removed along with its dependencies.

Command:

sudo apt-get remove –auto-remove python3.5

Remove Settings, Configs, Datafiles Collectively

Suppose a user wants to remove all the configurations and settings or data files related to a python package. In that case, he should mention the below command in the terminal and enter the machine’s password to continue.

Command:

sudo apt-get purge python3.5

Remove Configs, Data Files, and Dependencies of python3.5

If a user wants to collectively remove any Python package’s configuration, files, and dependencies, then the user must use the below command.

Command (for any version):

sudo apt-get purge –auto-remove python<version>

Command (for python3.5):

sudo apt-get purge –auto-remove python3.5
Salman Mehmood avatar Salman Mehmood avatar

Hello! I am Salman Bin Mehmood(Baum), a software developer and I help organizations, address complex problems. My expertise lies within back-end, data science and machine learning. I am a lifelong learner, currently working on metaverse, and enrolled in a course building an AI application with python. I love solving problems and developing bug-free software for people. I write content related to python and hot Technologies.

LinkedIn