python配置yum源
Posted effortsing
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python配置yum源相关的知识,希望对你有一定的参考价值。
import subprocess import sys import os def main(): try: subprocess.call(["cd /etc/yum.repos.d/ && mkdir repo_bak && mv *.repo repo_bak/"], shell=True) subprocess.call([" yum install wget -y && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo"], shell=True) subprocess.call(["yum clean all && yum makecache && yum repolist"], shell=True) sys.exit(0) except Exception as e: print(e) sys.exit(1) if __name__ == ‘__main__‘: main()
以上是关于python配置yum源的主要内容,如果未能解决你的问题,请参考以下文章
CentOS yum 命令出现 [Errno 14] curl#6 - "Couldn't resolve host ..." 的解决方法(代码片段
centos7升级python2.7后导致yum无法使用,按照网上的说法配置了/bin/yum的第
Error: Python executable “H:devpython3.10python.EXE“ is v3.10.0, which is not supported by gyp.(代码片段