Simple implementation of upgrading Centos Python2 to Python3, centospython3

Source: Internet
Author: User

Simple implementation of upgrading Centos Python2 to Python3, centospython3

1. Obtain the Python 3 package from the Python official website and switch to the/usr/local/src directory.

#wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz

2. Run the following command to decompress the package:

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

3. Create the directory-python3.5 in the/usr/local path, which is the installation directory in step 1.

$mkdir /usr/local/python3.5

4. Compile and install

$cd /usr/local/src/Python-3.5.1#./configure --prefix=/usr/local/python3.5#make all#make install#make clean#make distclean

5. Go to the absolute installation path and check whether the installation is successful.

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

6. Check the environment variables. By default, python is searched in the PATH order when python is started. python in/usr/bin 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 the soft connection and point to python3.5 when python is started.

1. Back up pythonmv/usr/bin/python/usr/bin/python2.6.62 and modify the soft connection sudo ln-s/usr/local/python3.5/bin/python3/usr/bin/python

8. Verify whether python3.5 is enabled by default.

$ python -V Python 3.5.1

The simple implementation of the above Centos Python2 upgrade to Python3 is all the content shared by the small editor. I hope you can provide a reference and support for the customer's house.

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.