Update the Python version under Linux and modify the default version, as a friend can refer to.
In many cases the server Python version is very low, you need to change the default Python version yourself
- 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. Unzip and install
tar -jxvf Python-2.7.tar.bz2 cd Python-3.3.0 ./configuremake all make installmake cleanmake distclean
- 3, Python By default is installed in/usr/local/bin/python2.7, you can execute the following command to view the version
- /usr/local/bin/python2.7-v The default python for the system is placed at/usr/bin/python2.6 (this 2.6 is the default version of the system)
- As a result, a soft connection is required to point to the current system's default Python directory, allowing the system to use the new Python version
- mv/usr/bin/python/usr/bin/python2.6//operate on the system default version of Python
- Ln-s/usr/local/bin/python2.7/usr/bin/python//Note The first path is a 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 installation of the Python plug-in is not in the new version of the Python directory, so need to reinstall
- 2, some people update the Python version can not use Yum, need to modify its configuration file for Yum
- Vi/usr/bin/yum Change the #!/usr/bin/python of the file header to #!/usr/bin/python2.6 (note that this is the previous version of the Python number, since the old version can support Yum)
- The above is a small series to share the Linux update Python version and modify the default version of the method, I hope you like.
Update the Python version under Linux and modify the default version