最新消息:

CentOS 8 安装 Python 3.8.0

centos admin 3733浏览 0评论

[root@aikaiyuan ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
[root@aikaiyuan ~]# dnf install libffi-devel -y

安装 OpenSSL 1.1.1d

[root@aikaiyuan ~]# wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
[root@aikaiyuan ~]# tar zxvf openssl-1.1.1d.tar.gz
[root@aikaiyuan ~]# cd openssl-1.1.1d/
[root@aikaiyuan ~/openssl-1.1.1d]# ./config --prefix=/usr/local/openssl-1.1.1d --openssldir=/usr/local/openssl-1.1.1d
[root@aikaiyuan ~/openssl-1.1.1d]# make -j
[root@aikaiyuan ~/openssl-1.1.1d]# make install
[root@aikaiyuan ~/openssl-1.1.1d]# echo "/usr/local/openssl-1.1.1d/lib/" > /etc/ld.so.conf.d/openssl-1.1.1d.conf
[root@aikaiyuan ~/openssl-1.1.1d]# ldconfig
[root@aikaiyuan ~/openssl-1.1.1d]# /usr/local/openssl-1.1.1d/bin/openssl version
OpenSSL 1.1.1d  10 Sep 2019

安装 Python 3.8.0

[root@aikaiyuan ~]# wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
[root@aikaiyuan ~]# tar zxvf Python-3.8.0.tgz
[root@aikaiyuan ~]# cd Python-3.8.0/
[root@aikaiyuan ~/Python-3.8.0]# vi Modules/Setup

修改 Setup 文件如下:

SSL=/usr/local/openssl-1.1.1d
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto
[root@aikaiyuan ~/Python-3.8.0]# ./configure --prefix=/usr/local/python-3.8.0 --with-openssl=/usr/local/openssl-1.1.1d --enable-optimizations
[root@aikaiyuan ~/Python-3.8.0]# make -j
[root@aikaiyuan ~/Python-3.8.0]# make install
[root@aikaiyuan ~/Python-3.8.0]# /usr/local/python-3.8.0/bin/python3
Python 3.8.0 (default, Nov 13 2019, 16:49:35)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.8.0 (default, Nov 13 2019, 16:49:35) \n[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]'
>>>

转载请注明:爱开源 » CentOS 8 安装 Python 3.8.0

您必须 登录 才能发表评论!