更新Python版本到Python3之后,yum运行出错
原因:yum依赖于Python2环境
0x01 python源
问题1:
yum install -y nodejs
/usr/bin/yum: line 3: import: command not found
/usr/bin/yum: line 4: try:: command not found
/usr/bin/yum: line 5: import: command not found
/usr/bin/yum: line 6: except: command not found
/usr/bin/yum: line 24: syntax error near unexpected token `('
/usr/bin/yum: line 24: `""" % (sys.exc_value, sys.version)'
解决方法:将已安装的Python2环境写入yum两个配置文件开头的注释中
1)which yum查看yum配置文件位置
which yum
/usr/bin/yum
2) which python查看python位置,找到后打开目录
3)建立Python2版本的软连接
ln -s (已安装的Python2环境) usr/bin/python2
或重命名rm 已安装的Python2版本 python2
4)vim /usr/bin/yum
将注释该为#!usr/bin/python2
5)vim /usr/libexec/urlgrabber-ext-down
将注释该为/usr/bin/yum中的一致
2安装出错
Error downloading packages:
2:nodejs-10.16.3-1nodesource.x86_64: [Errno 256] No more mirrors to try
解决:sudo yum clean all(清除yum命令缓存)
网友评论