Python3.7 installation (CentOS6.8)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/sqylqq/article/details/86182388

Install dependent packages:

yum install gcc libffi-devel zlib* openssl-devel libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

1, download the installation package

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz

2, extract

tar -zxvf Python-3.7.4.tgz

3, installation

-Prefix: Specify the installation location.
-With-ssl: ssl module, pip3 need to use. (If not not find the module)

cd Python-3.7.4
./configure --prefix=/usr/local/python3 --with-ssl
make
make install

4, establish a flexible connection

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

5, execute the command

python3

As shown below, proved successful installation:

Python 3.7.0 (default, Jan  9 2019, 10:18:01) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

6、pip3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

Problems may encounter the following
error:Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
reason: python3.7 need for openssl version 1.0.2 or 1.1.x, after viewing centos6.8 default version is openssl-1.0.1, see below

[root@centos6 sqy]# rpm -qa|grep ssl
openssl-devel-1.0.1e-58.el6_10.x86_64
openssl-1.0.1e-58.el6_10.x86_64

Solution: Upgrade openssl then recompile python3.7
Upgrade Reference links upgrade openssl

Guess you like

Origin blog.csdn.net/sqylqq/article/details/86182388