Recover after python2 was uninstalled by mistake

When installing walle, python always reports an error. The analysis is a python version problem. I want to change the system python to python3. After deleting /usr/bin/pythonthe soft link, I put python3 on the link, but it still doesn’t work. I ran it with my brain rpm -qa|grep python2|xargs rpm -ev --allmatches --nodepsand rpm -qa|grep python-2|xargs rpm -ev --allmatches --nodepsfound tragically yum. unusable……

cat /etc/redhat-release View current system versionCentOS Linux release 7.8.2003 (Core)

I found a yum dependency list on the Internet

libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
python-2.7.5-68.el7.x86_64.rpm
python-backports-1.0-8.el7.x86_64.rpm
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
python-chardet-2.2.1-1.el7_1.noarch.rpm
python-devel-2.7.5-68.el7.x86_64.rpm
python-iniparse-0.4-9.el7.noarch.rpm
python-ipaddress-1.0.16-2.el7.noarch.rpm
python-kitchen-1.1.1-5.el7.noarch.rpm
python-libs-2.7.5-68.el7.x86_64.rpm
python-pycurl-7.19.0-19.el7.x86_64.rpm
python-setuptools-0.9.8-7.el7.noarch.rpm
python-urlgrabber-3.10-8.el7.noarch.rpm
python-virtualenv-15.1.0-2.el7.noarch.rpm
rpm-4.11.3-32.el7.x86_64.rpm
rpm-build-4.11.3-32.el7.x86_64.rpm
rpm-build-libs-4.11.3-32.el7.x86_64.rpm
rpm-libs-4.11.3-32.el7.x86_64.rpm
rpm-python-4.11.3-32.el7.x86_64.rpm
rpm-sign-4.11.3-32.el7.x86_64.rpm
yum-3.4.3-158.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
yum-utils-1.1.31-45.el7.noarch.rpm

Use the rpm -qa | grep xxxcommand to find which one is missing, and then download one by one from http://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/

Fortunately, just uninstalled python related, and finally downloaded these

libxml2-python-2.9.1-6.el7.5.x86_64.rpm
python-2.7.5-89.el7.x86_64.rpm
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
python-devel-2.7.5-89.el7.x86_64.rpm
python-virtualenv-15.1.0-4.el7_7.noarch.rpm
rpm-build-4.11.3-45.el7.x86_64.rpm
rpm-sign-4.11.3-45.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm
yum-plugin-protectbase-1.1.31-54.el7_8.noarch.rpm

Perform rpm -ivh *.rpm --nodeps --forcemandatory installation of dependencies, and solve the problem

Guess you like

Origin blog.csdn.net/sxhexin/article/details/111504767