Skip to main content

yum is broken after upgrade python from 2.x to 3.x on CentOS 7

· One min read

yum is broken after upgrade python from 2.x to 3.x on CentOS7:

# yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^

Resolution: modify /usr/bin/yum and /usr/libexec/urlgrabber-ext-down, change first line from "#!/usr/bin/python" to "#!/usr/bin/python2":

#!/usr/bin/python<span style="color: #ff0000;">2</span>
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
...
#! /usr/bin/python<span style="color: #ff0000;">2</span>
# 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
ClustrMaps