Linux Update Python version and how to modify the Python default version _linux shell

Source: Internet
Author: User
Tags bz2

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.