Such as the title, installation docker warehouse configuration error:
[root@centos ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo Traceback (most recent call last): File "/usr/bin/yum-config-manager", line 6, in <module> import yum ImportError: No module named yum
Follow the prompts to read the yum-config-manage file:
[root@centos ~]# vi /usr/bin/yum-config-manager #!/usr/bin/python -tt import os, os.path import sys import re import yum sys.path.insert(0,'/usr/share/yum-cli') from utils import YumUtilBase import logging import fnmatch from iniparse import INIConfig
python here does not specify a version, look at the system's version
[root @ centos ~] # python - V Python 2.7 . 10
The actual python pointing to the 2.7 version. And the python yum version of it?
[root@centos ~]# vi /usr/bin/yum #!/usr/bin/python2.6 import sys try: import yum except ImportError: print >> sys.stderr, """\ There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:
So now it is clear that, when using yum config command execution, python yum itself is version 2.6, and has directed the implementation of config 2.7, so the error.
How to do? Either change the python version of yum, or change the config, try modifying config
[root@centos ~]# vi /usr/bin/yum-config-manager #!/usr/bin/python2.6 -tt
Configuring docker warehouse again, no longer being given:
[root@centos ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo Loaded plugins: fastestmirror adding repo from: https://download.docker.com/linux/centos/docker-ce.repo grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo docker-ce.repo | 2.4 kB 00:00 repo saved to /etc/yum.repos.d/docker-ce.repo