Update the Python version under Linux and modify the default version

Source: Internet
Author: User

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

Related Article

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.