others-how to solve python and yum update error ?

1. Purpose

In this post, I will show you how to solve yum update error when trying to install python3.
When I installed python3 and removed python2 on my linux server, I tried to update my yum repository by running the following command:

[root@localhost Python-3.11.5]# yum update
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
           ^^^^^^^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

but I got SyntaxError: multiple exception types must be parenthesized error, it seems that there is a syntax compatibility error between python3 and python2.

Let’s check current python version:

[root@localhost Python-3.11.5]# python --version
Python 3.11.5


2. Solution

We can try to install python2 again:

rpm -ivh python2.rpm

Then run yum update again, it works!
And according to this document , you can easily maintain two python environments on the same computer using conda or miniconda.

conda create --name py2 python=2.7

and this:

conda create --name py3 python=3.5

3. Summary

In this post, I demonstrated how to solve the python and yum update error. That’s it, thanks for your reading.