Python3.7 installation (ssl solve the problem)

Excerpt: https: //blog.csdn.net/love_cjiajia/article/details/82254371

python3.7 installation (to solve the problem of ssl)

1) Installation Preparation

yum -y install zlib zlib-devel 
yum -y install bzip2 bzip2-devel 
yum -y install ncurses ncurses-devel 
yum -y install readline readline-devel 
yum -y install openssl openssl-devel 
yum -y install openssl-static 
yum -y install xz lzma xz-devel 
yum -y install sqlite sqlite-devel 
yum -y install gdbm gdbm-devel 
yum -y install tk tk-devel

2) Installation libressl openssl-devel place 
because the system is openssl version 1.0.1, for python3.7 too old, or needs to be updated to openssl1.0.2 libressl2.64 (free) later versions, so here the official website libressl Download libressl source code, compiled library file instead of the system of openssl1.0.1

After the files are decompressed directory libressl-2.8.0

运行: ./config –prefix=/usr/local/ssl 
make 
make intall

mv /usr/bin/openssl /usr/bin/openssl.bak 
mv /usr/include/openssl /usr/include/openssl.bak 
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl 
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

cd /etc/ld.so.conf.d 
New File 
vim libressl-2.8.0.conf 
# following line to join the file, and save the 
/ usr / local / ssl / lib

ldconfig -v # reload library

Verify that the installation is complete 
[root @ testmachine hadoop_software] # OpenSSL Version 
libressl 2.8.0

3) Installation python3.7 
downloaded from the official website of the source python3.7, 
after decompression into the Python-3.7.0

We need to set environment variables before compiling (important) 
Export LDFLAGS = "- L / usr / local / ssl / lib" 
Export CPPFLAGS = "- the I / usr / local / ssl / the include" 
Export PKG_CONFIG_PATH = "/ usr / local / ssl / lib / pkgconfig "

./configure -prefix = / usr / python -enable  -shared CFLAGS = -fPIC
occur after running a bunch of information: 
Note that the last inspection of ssl, as shown below: 
Write pictures described here 
If the ssl version is too old or not set ssl environment before compilation variable here is not detected in ssl, pip3 after the installation is not available, it is very crucial!

After detection by running 
the make 
the make the install

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

Verify python installed correctly

import ssl no error

Write pictures described here

Reference: http://ju.outofmemory.cn/entry/363322

Guess you like

Origin www.cnblogs.com/LiuYanYGZ/p/12041788.html