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()
原文地址:https://www.cnblogs.com/effortsing/p/9986325.html
时间: 2024-11-13 07:51:22