跳转至内容
0
  • 版块
  • 讨论
  • 最新
  • 标签
  • 热门
  • 顶端
  • 用户
  • 版块
  • 讨论
  • 最新
  • 标签
  • 热门
  • 顶端
  • 用户
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Zephyr)
  • 不使用皮肤
折叠
JIKE社区
  1. 首页
  2. 讨论区
  3. 技术专区
  4. CentOS 7 python2.7.5 升级到 python 2.7.18 步骤以及问题

CentOS 7 python2.7.5 升级到 python 2.7.18 步骤以及问题

已定时 已固定 已锁定 已移动 技术专区
1 帖子 1 发布者 438 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 我是小马甲~M 离线
    我是小马甲~M 离线
    我是小马甲~
    🤫
    写于 最后由 malaohu 编辑
    #1

    python升级

    yum install gcc openssl-devel bzip2-devel 
    
    
    cd /usr/src
    wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
    
    tar xzf Python-2.7.18.tgz
    
    cd Python-2.7.18
    ./configure --enable-optimizations
    make altinstall
    
    /usr/local/bin/python2.7 -V
    
    # Python 2.7.18
    
    mv /usr/bin/python /usr/bin/python2.7.5
    
    ln -s /usr/local/bin/python2.7 /usr/bin/python
    
    

    pip安装

    wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
    python get-pip.py
    

    各种错误

    No module named yum

    更新完后,yum 不能用了!!

    There was a problem importing one of the Python modules
    required to run yum. The error leading to this problem was:
    
       No module named yum
    
    Please install a package which provides this module, or
    verify that the module is installed correctly.
    
    It's possible that the above module doesn't match the
    current version of Python, which is:
    2.7.18 (default, Jul 20 2021, 22:48:22) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
    
    If you cannot solve this problem yourself, please go to 
    the yum faq at:
      http://yum.baseurl.org/wiki/Faq
    

    修改:/usr/bin/yum

    #!/usr/bin/python2.7.5
    

    No module named urlgrabber.grabber

    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Traceback (most recent call last):
      File "/usr/libexec/urlgrabber-ext-down", line 22, in <module>
        from urlgrabber.grabber import \
    ImportError: No module named urlgrabber.grabber
    

    修改:vi /usr/libexec/urlgrabber-ext-down
    同上

    唐宋元明清,连排小工兵!

    1 条回复 最后回复
    0
    回复
    • 在新帖中回复
    登录后回复
    • 从旧到新
    • 从新到旧
    • 最多赞同


    Popular Topics - 热门主题
    • 开源单词与文章练习工具:TypeWords
      IntDoubleFloatI
      IntDoubleFloat
      2
      8
      198

    • 25年11月03日Windows 10(11)专业版在线激活密钥
      M
      mtp100
      2
      6
      173

    • <国剧>四喜[2025][剧情][童瑶 蒋欣 黄明昊 许娣]4K
      undefined
      0
      1
      3

    • <电影>蛟龙行动 (2025)[动作 战争][黄轩 于适 张涵予 段奕宏 王俊凯]4K高码
      undefined
      0
      1
      1

    • <日剧>地狱是由善意构成的 (2025)[日本 悬疑][草川拓弥]
      undefined
      0
      1
      1

    • 多人有声剧《玄医枭后》主播:半纸鸿鹊 1044集完
      undefined
      0
      1
      1

    • 登录

    • 没有帐号? 注册

    • 登录或注册以进行搜索。
    百度网盘
    2,521 个主题
    夸克网盘
    1,579 个主题
    连续剧
    1,027 个主题
    国产剧
    728 个主题
    美剧
    479 个主题
    动作片
    337 个主题
    动画片
    314 个主题
    中国移动
    307 个主题

    115

    在线

    42.5k

    用户

    42.9k

    主题

    114.1k

    帖子
    • 第一个帖子
      最后一个帖子