yum is not working after entering in command in RHEL 7

6,741

Solution 1

Reinstall python. Redhat or even yum requires python 2

If you dont have the rpm, it is available from the distro, so you could mount the iso (if you have it to hand)and get it from there, or download the python 2.7 rpm to your server. Cd to the directory the downloaded rpm is in.

Install it with something like:

rpm -ivh python*

Then you need might need to point /usr/bin/python to python2.6

sudo ln -s /usr/bin/python2.6 /usr/bin/python

Solution 2

Hopefully you have the .rpm kicking around; you used rpm to remove it; just use rpm to reinstall it. And be more careful with --nodeps in the future.

Solution 3

If you removed the rpm package of Python you need to reinstall it again.

Go to Below URL and wget latest new python package

wget "python-2.7.5-86.el7.x86_64.rpm"

something like this and install it with {rpm} cmd

why we need this package, because yum utility uses python package.

Regards,

Wajid Shaikh

Share:
6,741
W.Smith
Author by

W.Smith

Updated on September 18, 2022

Comments

  • W.Smith
    W.Smith over 1 year

    I entered in a command:

    $ rpm -e --nodeps python 
    

    and after that I get this when I try to enter in something with yum:

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

    So what is the best way to get yum back since it broke after entering in the rpm -e --nodeps python?

  • W.Smith
    W.Smith almost 6 years
    I'm getting error: File not found by glob: python* after entering in rpm -ivh python*
  • Mark Plotnick
    Mark Plotnick almost 6 years
    If you have another RHEL system with the same release, you can use yumdownloader on it to download the RPM, then copy it to your system and run rpm as in this answer.