Centos Python2 upgrade to Python3

Source: Internet
Author: User
Tags create directory

1. From the Python website to the package that gets Python3, switch to directory/USR/LOCAL/SRC

#wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.5.1/PYTHON-3.5.1.TAR.XZ

2. Extract the following command using the command:

1 xz-d Python-3.5.1. Tar.xz2 tar-xf python-3.5.1.tar.xz

3. Create directory--python3.5 under/usr/local path, install directory for 4th step

$mkdir/usr/local/python3.5

4. Compiling the installation

$CD/usr/local/src/python-3.5.1#. /configure--prefix=/usr/local/python3.5#make all#make install#make clean#make Distclean

5. Enter the absolute path of the installation to check if the installation is successful

$/usr/local/python3.5/bin/python3.5-v
Python 3.5.1

6. View the environment variables, start Python by default in the order of path to find, in/usr/bin python at this time is Python2.6.

$echo $PATH /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/ Gordon/bin

7. Modify soft connection, point to python3.5 when starting Python

1 backing up python
mv/usr/bin/python/usr/bin/python2.6.6
2 Modifying a soft connection
sudo ln-s/usr/local/python3.5/bin/python3/usr/bin/python

8. Verify that python3.5 is started by default

$ python-V python 3.5.1

Centos Python2 upgrade to Python3

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.