今天准备在Cent OS7中运行yum install python报如下错误:

[root@bogon ~]# yum install python-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.nju.edu.cn
* updates: mirrors.nju.edu.cn
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax


Exiting on user cancel

Cent OS7中安装的版本是:

[root@bogon ~]# python -V
Python 3.5.2

从网上查是因为urlgrabber-ext-down这个文件没有修改

[root@bogon ~]# vi /usr/libexec/urlgrabber-ext-down

将#! /usr/bin/python 更新为#! /usr/bin/python2.7.5(我的旧版本中是2.7.5)

#! /usr/bin/python2.7.5
# A very simple external downloader
# Copyright 2011-2012 Zdenek Pavlas

# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

保存后正常

 

posted on 2017-09-14 13:23  beauqi  阅读(337)  评论(0编辑  收藏  举报