Try to do rpm -e.
Something like:
Answer from dmourati on serverfault.com$ sudo rpm -e python-2.7.5-86.el7.x86_64
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
How to yum remove Python gracefully? - Unix & Linux Stack Exchange
python - How to uninstall Python2.6 - Stack Overflow
python - Uninstalling Python3.5 from Linux RHEL - Stack Overflow
So.. removing Python 2.7.5 from Centos 7.x?
Uninstalling the system Python is a bad idea. There are many other packages and softwares that depend on it. It'll be better that you use python2.7 by either modifying the $PATH or creating an alias e.g. python2.7 that points to the python that you installed in /opt dir.
Uninstalling fedora-provided python 2.6 might break many packages that depend on it. I advise you against doing it.
Now, your problem is simply that $PATH and similar variables ($MAN_PATH etc.) are searched from left to right. You appended your new /opt/python27/bin after standard locations like /usr/bin. Reverse the order, and you will get /opt/python27/bin/python as a default python binary.