Yum crashed with Keyboard Interrupt error

SSAMEERR picture SSAMEERR · Jun 26, 2012 · Viewed 55.9k times · Source

I installed the newer version of python (3.2.3) than the one available in Fedora16 (python2.7)

And now yum stops working. It shows the following error.

[root@localhost yum-3.4.3]# yum
  File "/usr/bin/yum", line 30
   except KeyboardInterrupt, e:
                           ^
SyntaxError: invalid syntax

Please advice as how to resolve the error. It would be helpful as I am not able to update or install any package.

Answer

peakmuma picture peakmuma · May 9, 2015

Because yum does not support Python3.
You can run command vi /usr/bin/yum, change /usr/bin/python to /usr/bin/python2 in first line.
Thus you can run the command yum by Python2 instead of Python3.

Note however that this will make your setup unsupported and thus unmaintainable (as does what you did). You will likely have other similar problems in the future with other system packages.
If you want to use an alternative Python installation, consider installing it into /usr/local, /opt or using pyenv.