个人博客导航页(点击右侧链接即可打开个人博客):大牛带你入门技术栈
安装maven,环境虚拟机:
1.安装yum配置工具
$ yum install -y yum-utils
2.使用配置工具配置第三方epel源仓库
[root@ab0be27c0bd3 ~]# yum-config-manager --add-repo http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo
Traceback (most recent call last):
File "/usr/bin/yum-config-manager", line 6, in <module>
import yum
ImportError: No module named yum
执行这一步报错
Traceback (most recent call last):
File "/usr/bin/yum-config-manager", line 6, in <module>
import yum
ImportError: No module named yum
根据报错查看文件:
[root@ab0be27c0bd3 ~]# cat /usr/bin/yum-config-manager | head -n 10
#!/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
说是找不到yum模块,但是yum命令是可以正常使用,百度说是版本不匹配,yum使用python写的
查看python的版本
[root@ab0be27c0bd3 ~]# whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python2.7-config /usr/bin/python2.6 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/local/bin/python /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/lib/python2.7 /usr/include/python2.7 /usr/share/man/man1/python.1.gz
[root@ab0be27c0bd3 ~]#
[root@ab0be27c0bd3 ~]#
[root@ab0be27c0bd3 ~]# python -V
Python 2.7.9
可以看到有多个版本,使用中的是2.7.9
看一下 yum使用的版本
[root@ab0be27c0bd3 ~]# cat /usr/bin/yum
#!/usr/bin/python
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
其实看不出来呀,再看下python的软连接:
[root@ab0be27c0bd3 ~]# ls -il /usr/bin | grep python
33555577 -rwxr-xr-x 1