Linux installation Python 3

Source: Internet
Author: User
Tags python script

Method:

1. Official website:http://www.python.org/download/

2, rz-y upload to Linux decompression TAR-XVZF python-3.5. 1.tgz Enter the directory CD python-3.5. 1/

3. Compile and install

./configure--prefix=/usr/python

TweenConfigureWhen the command finishes executing, it generates amakefile  file, this   makefile The main is the next  make  command. Open  makefile linux  need to follow makefile  The order specified to build   program component. Make command

After performing the make install command to this basic installation is complete

------------------------------------------------------------------------

After the installation is successful, the installation directory is/usr/python

The original python in the system is in/usr/bin/python, ls-l can see that Python is a soft link to the python2.7 in this directory

We can either delete this or create a new Python3 soft link, except that Python will change to Python3 when executed, or the Python script header declaration will be changed to #!/usr/bin/python3

In order to facilitate the suggestion to rename first, and then create a soft link on it, the previous program head does not have to change:

mv/usr/bin/python/usr/bin/ln-s/usr/python/bin/python3/usr/bin/python
Then enter Python to check the Python version

Linux installation Python 3

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.