zoukankan      html  css  js  c++  java
  • centos 卸载python和yum之后的解决办法

    网上看到有同学yum不能使用的消息,出现了下面的结果

    无赖的使用了网上的很多方法,还是不行。

    于是我卸载了python和yum,觉得自己重新安装python和yum。

    步骤1:卸载python

    rpm -qa|grep python|xargs rpm -e --allmatches --nodeps
    
    whereis python|xargs rm -fr

    步骤2:卸载yum

    rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps
    
    rm -rf /etc/yum.repos.d/*
    
    whereis yum|xargs rm -fr

    步骤3:安装python

    在任何一个镜像站中找到你系统对应版本的python rpm包(我的是centos 6.9的64位系统,使用的镜像是http://mirrors.163.com/centos/6.9/os/x86_64/Packages/)

    mkdir /usr/local/src/python
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-2.6.6-66.el6_8.x86_64.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-devel-2.6.6-66.el6_8.x86_64.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/rpm-python-4.8.0-55.el6.x86_64.rpm

    切换到/usr/local/src/python路径下

    rpm -ivh python-*   rpm-python-* 

    如果中间过程出现了类似下面的代码,这是包与包之间的依赖关系,只需要卸载已经安装的包(rpm -e 包名(没有.rpm后缀)),然后先安装依赖包

    如:

          rpm -e yum-metadata-parser-1.1.2-16.el6.x86_64
    
           rpm -ivh /yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

    步骤4:安装yum

    mkdir /usr/local/src/yum
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm  
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  
    
    wget http://mirrors.163.com/centos/6.9/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

    切换到/usr/local/src/python路径下

    rpm -ivh yum-*

    步骤5:测试

    运行

    yum

    (成功)

     

  • 相关阅读:
    Easy | LeetCode 108. 将有序数组转换为二叉搜索树
    Medium | LeetCode 105 | 剑指 Offer 07. 从前序与中序遍历序列构造二叉树
    Easy | LeetCode 543. 二叉树的直径
    Easy | LeetCode 235 | 剑指 Offer 68
    Easy | LeetCode 236 | 剑指 Offer 68
    Medium | LeetCode 114. 二叉树展开为链表 | 先序遍历 | 递归 | 迭代
    Medium | LeetCode 538,1038. 把二叉搜索树转换为累加树
    Medium | LeetCode 230. 二叉搜索树中第K小的元素
    Easy | 剑指 Offer 54. 二叉搜索树的第k大节点
    stl(5)vector容器
  • 原文地址:https://www.cnblogs.com/phpandmysql/p/7066399.html
Copyright © 2011-2022 走看看