Try to do rpm -e.

Something like:

$ sudo rpm -e python-2.7.5-86.el7.x86_64

Answer from dmourati on serverfault.com
🌐
Stack Overflow
stackoverflow.com › questions › 39261624 › uninstall-python-3-5-2-from-redhat-linux
Uninstall Python 3.5.2 from Redhat Linux - Stack Overflow
wget https://www.python.orf.ftp/python/3.5.2/Python-3.5.2.tgz tar -xvf Python-3.5.2.tgz cd Python-3.5.2.tgz ./configure make install ls /usr/local/bin //python 3.5.2 is stored at this location ... Unless you really need the space, why go to the trouble of the uninstall (especially as down the road you'd realise you do need Python3)?
🌐
Reddit
reddit.com › r/redhat › i made a huge mistake by removing python..
r/redhat on Reddit: I made a huge mistake by removing python..
October 2, 2020 -

Hey guys,
TLDR: We would have needed python 3, somehow we never managed to get it done on RHEL7.8, and someone suggested to remove python so it may help.. ofc as a noob i did it. Saw all the stuff it removed.. BUT i never restarted so the PC is still running. Can i somehow reinstall python to undo this disaster?
Thanks in advance

Discussions

How to yum remove Python gracefully? - Unix & Linux Stack Exchange
I just tried to upgrade the Python installation on my CentOS machine. After few times of failure, I did yum remove python. Then problems started to happen. yum found about 300 dependencies on the More on unix.stackexchange.com
🌐 unix.stackexchange.com
October 1, 2014
python - How to uninstall Python2.6 - Stack Overflow
How will I make the system use python2.7 as its default python? Or if possible, how will I uninstall python2.6? Thanks in advance! ... It's generally a bad idea to try to remove the system python on linux machines. More on stackoverflow.com
🌐 stackoverflow.com
python - Uninstalling Python3.5 from Linux RHEL - Stack Overflow
To re-add Python 3.x, go here to ... http://developers.redhat.com/products/softwarecollections/get-started-rhel6-python/ This is for 3.4, but you can use these instructions for 3.5 too. ... Because python is integral into the RHEL OS, please explain what you mean by: "and made it default over existing Python2.6 ." Otherwise attempts to "uninstall" your working ... More on stackoverflow.com
🌐 stackoverflow.com
June 27, 2016
So.. removing Python 2.7.5 from Centos 7.x?
There is no reason to get rid of it. It’ll be supported by Red Hat for the entire lifecycle of RHEL7. More on reddit.com
🌐 r/CentOS
18
0
January 12, 2020
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_enterprise_linux › 9 › html › installing_and_using_dynamic_programming_languages › assembly_introduction-to-python_installing-and-using-dynamic-programming-languages
Chapter 1. Introduction to Python | Installing and using dynamic programming languages | Red Hat Enterprise Linux | 9 | Red Hat Documentation
The python command is intended for interactive sessions. In production, it is recommended to use python3, python3.9, python3.11, or python3.12 explicitly. You can uninstall the unversioned python command by using the dnf remove /usr/bin/python command.
🌐
Linux.org
linux.org › home › forums › general linux forums › general linux topics
remove python 3.8.5 packages completely with ints dependencies from rhel 8 | Linux.org
September 16, 2020 - Removing python and it's dependencies could break the system, seriously:- If you have a subscription and are running a server I 'strongly recommend' that you call Red Hat for support. 1-888-733-4281. Chapter 5.1 of this PDF for RHEL 8 explains how to remove packages. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/pdf/installing_managing_and_removing_user-space_components/Red_Hat_Enterprise_Linux-8-Installing_managing_and_removing_user-space_components-en-US.pdf
🌐
Red Hat
access.redhat.com › solutions › 6964428
Can I remove Python 2.7 from RHEL7? - Red Hat Customer Portal
January 15, 2025 - Is it safe to remove Python 2.7 from RHEL7? I have installed Python 3, therefore want to remove Python 2 which is End of Life I got error message when trying to yum remove Python 2.7 package
🌐
Linux Questions
linuxquestions.org › questions › linux-software-2 › remove-python-3-8-5-packages-and-dependencies-completely-from-rhel-8-a-4175682213
[SOLVED] remove python 3.8.5 packages and dependencies completely from rhel 8
September 16, 2020 - How to remove python 3.8.5 and including its packages and dependencies completely from red hat linux 8 enterprise version from gcp instance? please
Top answer
1 of 1
12

Python is required by many of the Linux distributions. Many system utilities the distro providers combine (both GUI based and not), are programmed in Python.

The version of python the system utilities are programmed in I will call the "main" python. For Ubuntu 12.04 e.g. this is 2.7.3, the version that you get when invoking python on a freshly installed system.

Because of the system utilities that are written in python it is impossible to remove the main python without breaking the system. It even takes a lot of care to update the main python with a later version in the same major.minor series, as you need to take care of compiling it with the same configuration specs as the main python. This is needed to get the correct search paths for the libraries that the main python uses, which is often not exactly what a .configure without options would get you, when you download python to do a python compilation from source.

Installing a different version from the major.minor version the system uses (i.e. the main python) normally is not a problem. I.e. you can compile a 2.6 or 3.4 python and install it without a problem, as this is installed next to the main (2.7.X) python. Sometimes a distro provides these different major.minor packages, but they might not be the latest bug-release version in that series.

The problems start when you want to use the latest in the main python series (e.g. 2.7.8 on a system with main python version is 2.7.3). I recommend not trying to replace the main python, but instead to compile and install the 2.7.8 in a separate location (mine is in /opt/python/2.7.8). This will keep you on the security fix schedule of your distribution and guarantees someone else tests compatibility of the python libraries and against that version (as used by system utilities!).

For any development using that version of python, use virtualenv, (or virtualenvwrapper) and setup a 2.7.8 environment using:

virtualenv -p /opt/python/2.7.8/bin/python /tmp/test
source /tmp/test/bin/activate

(the second line assumes you are using bash)

Find elsewhere
🌐
MTU Service Desk
servicedesk.mtu.edu › TDClient › KB › ArticleDet
Installing, uninstalling, or upgrading Python modules using Pip (Linux)
You can install and uninstall packages for Python with the Pip package manager. Python modules that are stored on your home drive will only be accessible by you, but there may be modules that are globally installed on some systems. Other students, faculty, and staff that require the same packages will have to individually run the following commands as well for shared Python projects. Fully managed RedHat Linux systems come with various Python versions installed by default.
🌐
YouTube
youtube.com › carberra
Install (and uninstall) ANY Python version on Linux - YouTube
On Linux, the hardest part of using Python is really in the installation. Sure, you can use the repos, but they tend to be out of date, and you're desperate ...
Published   October 14, 2022
Views   19K
🌐
Python Central
pythoncentral.io › how-to-uninstall-python
How to Uninstall Python | Python Central
February 5, 2025 - Let us give you a quick review of the options to uninstall Python. In Windows, uninstalling Python is as easy as installation: downloading the Python installer and following the installer wizard. Linux: sudo ln -s /usr/bin/python3 /usr/bin/python
🌐
Local Host
locall.host › home › uninstall › master the removal process: a comprehensive guide to uninstalling python in linux environments
Master the Removal Process: A Comprehensive Guide to Uninstalling Python in Linux Environments
August 10, 2023 - One such example is the removal of Python in Linux. Here are the effortless steps to help you master the art of app removal: 1. Access the terminal: Open the terminal in your Linux system, as this will be the primary tool for the uninstallation process.
🌐
Leapcell
leapcell.io › blog › how-to-uninstall-python-a-comprehensive-guide
How to Uninstall Python: A Comprehensive Guide | Leapcell
July 25, 2025 - This guide provides detailed steps to uninstall Python from Windows, macOS, and Linux systems.
🌐
Educative
educative.io › answers › how-to-uninstall-python
How to uninstall Python
For Python 3 and above, first perform the following steps: ... Click “Applications” in the menu on the left. Find the Python folder with the version number you want to uninstall, right-click it, and select the “Move to Trash” option.
🌐
Stack Overflow
stackoverflow.com › questions › 38050053 › uninstalling-python3-5-from-linux-rhel
python - Uninstalling Python3.5 from Linux RHEL - Stack Overflow
June 27, 2016 - To re-add Python 3.x, go here to use a software collection which installs "along side" the original 2.6 - so no collisions/corruption. http://developers.redhat.com/products/softwarecollections/get-started-rhel6-python/ This is for 3.4, but you can use these instructions for 3.5 too. ... Because python is integral into the RHEL OS, please explain what you mean by: "and made it default over existing Python2.6 ." Otherwise attempts to "uninstall" your working python install might leave you with a broken RHEL install.
🌐
Red Hat
access.redhat.com › solutions › 7087040
Can python-dns be uninstalled from an IPA Server? - Red Hat Customer Portal
We wish to uninstall python-dns from our IPA Server. Red Hat Enterprise Linux 7 · Red Hat Enterprise Linux 8 · Red Hat Enterprise Linux 9 · A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more. Log in for full access Log In ·
🌐
Linux.org
linux.org › home › forums › general linux forums › getting started
Python on Linux - Install/uninstall/reinstall | Linux.org
January 23, 2022 - I don't think you can uninstall python the way you think. A lot of applications, if not all, are so deeply dependent on it that you'd have to uninstall everything in order to remove it.
🌐
LinuxVox
linuxvox.com › blog › uninstall-python-linux
Uninstall Python on Linux: A Comprehensive Guide — linuxvox.com
Package managers like apt (for Debian-based systems such as Ubuntu), yum (for Red Hat-based systems like CentOS), and dnf (a modern replacement for yum in Fedora) are used to manage software packages on Linux. They keep track of dependencies and make it easier to install, update, and uninstall software. Virtual environments are isolated Python environments that allow you to install packages without affecting the system-wide Python installation.