Accidentally deleted python and yum is not working in centos7 [closed]
I am new to linux and was trying to delete python so I can install it from scratch. Instead of deleting only the python files in /usr/local/bin/ I also deleted these:
/usr/bin/python
/usr/bin/python2.7
/usr/lib/python2.7
/usr/lib64/python2.7
/etc/python
/usr/include/python2.7
/usr/share/man/man1/python.1.gz
/usr/src/Python-3.7.3/python
Now whenever I try to use yum I get:
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
Is there a way to fix this or is reinstalling centos7 my only hope?
If it's the latter, how can I do so on a remote server that I have no physical access to?
Solution 1:
You can simply download the packages and install them again with rpm
, without having python on your system and a broken yum
.
Find the version you had installed
rpm -qf /usr/bin/python
Then find a download URL and either download and install in one go or in separate steps:
sudo rpm --reinstall -v https://rpmfind.net/linux/centos/7.8.2003/os/x86_64/Packages/python-2.7.5-88.el7.x86_64.rpm