The yum exception caused by CentOS6. x updating the default Python version of the system: File "/usr/bin/yum", line 30

The yum exception caused by CentOS6. x updating the default Python version of the system: File "/usr/bin/yum", line 30

CentOS6. x upgrades Python to Python 3.4.3, and updates the default Python version of the system When using yum to install or upgrade software, the following errors will be prompted

#yum update -y
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax

Error reason:

This is because yum uses python as the command interpreter, which can be found from the first line # in the/usr/bin/yum file/ Usr/bin/python discovery. However, the compatibility between Python versions is not very good, which makes the syntax inconsistency between 2.6 and 3.4 versions. CentOS 6's own yum uses

python2.6.6, When the system upgrades python to 3. x, syntax interpretation errors occur.

terms of settlement:
Modify the yum interpreter to the old version of python 2.6 (if you do not use overwrite upgrade).

#vi /usr/bin/yum
Change the first line "#!/usr/bin/python" to "#!/usr/bin/python 2.6".

 yum_error

 yum_error2

The installation and use of Python Pip and Python gevent under CentOS6. x

The installation and use of Python Pip and Python gevent under CentOS6. x
CentOS6.5 Installing gevent can improve server performance

Pip is a tool for installing Python packages. It provides the functions of installing, listing installed packages, upgrading, and uninstalling packages. Pip is a replacement for easy_install. It provides the same function of finding packages as easy_install. Therefore, packages that can be installed using easy_install can also be installed using pip.
At present, many Python programs can be installed directly through Pip, such as the well-known Django, Markdown, Shadowsocks, etc.
Before installing Pip, you must first install setuptools. Before installing setuptools, you must install Python. The installation process between them is dependent and indispensable.
1. Check Python version
#python --version
The Python version installed by default for CentOS6.5 is 2.6.6, and the return value is Python 2.6.6
2. Install setuptools
#yum install -y python-setuptools
After installation, the easy_install command can be used.
3. Install pip//pip-8.0.2
#easy_install pip
Installing pip through easy_install is the easiest way. Pip is installed in the/usr/bin directory by default.
4. Install shadowlocks
#pip install shadowsocks
5. Install gevent
Installing gevent can improve the performance of Shadowsocks. Installing gevent under CentOS depends on libevent and greenlet.
Install libevent:
#yum install -y libevent

To install greenlet:
#yum groupinstall "Development Tools" -y
#pip install greenlet

Install gevent:
Pip install gevent or easy_install gevent//error: Setup script exited with error: command 'gcc' failed with exit status 1

Briefly introduce the usage of Pip (for example, installing gevent):
1. Installation package
pip install gevent

2. List installed packages
pip freeze

3. Install a specific version of the package
pip install gevent==1.0.2
pip install gevent>=1.0.2,<=1.0.2

4. Upgrade the installed package to the latest version
pip install -U gevent

5. Uninstall installed packages
pip uninstall gevent

6. Query installed packages
pip search "gevent"

https://teddysun.com/339.html
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6


CentOS6. x Install and Upgrade Python 2.7. x Python 3.4. x