Saturday, September 3, 2022

[SOLVED] -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

Issue

root@host [~]# yum

-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

None- Actually, I deleted old python2.6 directory and install new python2.7 in linux redhat 4.4.7 OS.


Solution

Don't modify the system python; too many things rely on it (like your package manager!). If you want to install a different version of Python, install it somewhere else (/usr/local, your home directory, etc).

If you actually deleted the python2.6 directory (e.g., /usr/lib/python2.6), you haven't just deleted python 2.6 -- you have deleted any additional python modules that were installed on your system, potentially breaking all sorts of things. There's not really a good way to recover from this situation.

If you were to restore the /usr/lib/python2.6 directory from another system you would at least be able to run yum again, although your system would still be fundamentally broken. Your best bet is to reinstall from scratch.

If you only deleted the python2.6 binary and left the library directory intact, you could simply restore /usr/bin/python2.6 and things would be relatively back to normal.



Answered By - larsks
Answer Checked By - Senaida (WPSolving Volunteer)