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.