centos中使用yum报错

发布时间 2023-12-30 10:50:31作者: 一先生94

1、执行yum repolist具体报错内容

Loaded plugins: product-id, search-disabled-repos,subscription-manager
This system is not registered with an entitlement server. You can use subacription-manager to register.
  File "/usr/libexec/urlgrabber-ext-down", line 28
    except OSError,e:
                ^
SyntaxError: invalid syntax

Exziting on user cancel

2、原因

原因为升级python后新建了软连接指向了新版本,除非同时升级yum不然无法使用。需要手动更改报错文件指向新版本后即可解决。

3、更改文件内容

更改文件头行:#! /usr/bin/python

更改为:#! /usr/bin/python2

 

特别注意:yum是依赖Python2.7。