---
title: "yum-config-manager --add-repo"
author: "chy0919"
date: "2019-12-04T11:56:32Z"
tags: []
categories: ["开源软件"]
slug: "yum-config-manager-add-repo"
draft: false
lastmod: "2019-12-04T11:56:32Z"
id: 2510791
url: "https://chy0919.iteye.com/blog/2510791"
---

今天在安装docker时，通过yum-config-manager挂载镜像时，出现以下错误

\[root@promote ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  File "/usr/bin/yum-config-manager", line 131

    except yum.Errors.RepoError, e:

                               ^

SyntaxError: invalid syntax

后经过排查，因为python版本做了升级，目前为3.6.3

\[root@promote ~]# python -V

Python 3.6.3

但是没有修改/usr/bin/yum-config-manager文件中的头为python2，将头做修改，修改如下

#!/usr/bin/python2 -tt

 

再次执行yum-config-manager，正常，在此记录下，便于再次遇到时能快速解决。