CentOS compilation and installation of Python3

Source: Internet
Author: User

CentOS compilation and installation of Python3
Preface

Recently I want to learn a new advanced language. I accidentally saw the github project using python to simulate AIphaGo, And I decided on him.

Git portal of AIphaGo:
Https://github.com/Rochester-NRT/AlphaGo

Tossing

Python Official Website:
Https://www.python.org/

View related comments. Everyone calls python2 and python3 as two languages. Since there is little inheritance, I will learn python3 directly.

In the system selection, it also picked a difficult route, installed in the Linux system, CentOS.

This will not be nonsense. The following is the topic.

Compile and install

The python official website only provides the source code for Linux, So I downloaded the python 3.5.1 source code compressed package.

Step 1: Install the openssl static library on CentOS

Type the following command:

$ yum install -y openssl-static

If the static library is not installed, the installation of pip3 in python3 will fail.

Step 2: Compile python3 source code 0. CentOS to install GCC
$ yum install -y gcc
1. decompress the python 3 source code package.
$ tar -zxvf Python-3.5.1.tgz
2. Configure the installation path
$ Cd Python-3.5.1 // enter the decompressed python3 source code folder $./configure -- prefix =/usr/local/python3 // default configuration file and set the installation path
3. Compile Python 3 source code
$ make
4. Installation
$ make install

If no error message is displayed, the installation is successful.

5. Add file links

After installation, enter the commandpython3This command does not exist because we have customized the installation directory. Therefore, we need to add a file link. The command is as follows:

$ ln -s /usr/local/python3/bin/python3 /usr/bin/python3
6. Test

Type the following command:

$ python3 -V

The python3 version is output, indicating that python3 has been installed.

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.