Linux to update the Python version and modify the default version, the need for friends can refer to the next.
In many cases, the server Python version is very low, you need to change the default Python version
1, download the Python installation package from the official website (this version can be any version 3.3 2.7 2.6, etc.)
wget http://python.org/ftp/python/2.7/Python-2.7.tar.bz2
2, decompression and installation
TAR-JXVF python-2.7.tar.bz2
cd Python-3.3.0
./configure make all make
install
Make Distclean python is installed by default in/usr/local/bin/python2.7, you can perform the following command to view the version
/usr/local/bin/python2.7-v and the system's default python is placed at/usr/bin/python2.6 (this 2.6 is the default version of the system)
So at this point you need to establish a soft connection to the current system default Python directory where the system uses the new Python version
mv/usr/bin/python/usr/bin/python2.6//operating the system default version of Python
Ln-s/usr/local/bin/python2.7/usr/bin/python//Note The first path is the newly installed Python version path, and the second path is the system default path
When the modification is complete, enter python-v or Python to see that the version number has been modified to the newly installed version.
Ps:
1, modified the new Python version, then the original installed Python plug-ins are not in the new version of the Python directory, so need to reinstall
2, some people have updated the Python version cannot use Yum, need to modify its configuration file for Yum
Vi/usr/bin/yum the #!/usr/bin/python of the file head to #!/usr/bin/python2.6 (note that this is the previous version of the Python, because the older version can support Yum)
The above content is small to share the Linux update Python version and modify the default version of the method, I hope you like.