Centos7 How to install Python3

Source: Internet
Author: User

Because CENTOS7 originally installed the Python2, and this Python2 can not be deleted, because there are many system commands, such as Yum to use.

[Email Protected]_105_217_centos python-3.6.2]# Pythonpython 2.7.5 (default,  4, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on Linux2type ' help ', ' copyright ', ' credits ' or ' license ' for more information.

Enter the python command to see what you know is the Python2.7.5 version

Input

which Python

You can view the location, which is typically located in the/usr/bin/python directory.

The following describes how to install Python3

Install the dependency package first

Yum-y Groupinstall "Development tools" Yum-y install Zlib-devel bzip2-devel openssl-devel ncurses-devel Sqlite-devel Read Line-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Then according to their own needs to download different versions of Python3, I downloaded the Python3.6.2

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

If the speed is not fast enough, you can go directly to the official website to download, using WINSCP and other software to the designated location on the server, my storage directory is/usr/local/python3, using the command:

Create an empty folder

Then unzip the package, enter the directory, install Python3

TAR-XVJF  Python-3.6.2.tar.xz
CD Python-3.6.2
./configure--prefix=/usr/local/python3
Make && make install

Finally create a soft link

Ln-s/usr/local/python3/bin/python3/usr/bin/python3ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3

Enter the Python3 test on the command line

Centos7 How to install Python3

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.