Linux(服务器)版本的Python3.7.4 安装

本文介绍了如何在Linux服务器上通过源码方式安装Python3.7.4,包括下载源码、解决编译错误、安装libressl、更新模块加载目录、修改编译配置、安装成功后的版本切换方法等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 源码下载

从https://www.python.org/下载源码。
我这里下载最新的 Python3.7.4。

2. Linux(服务器)版本的Python3.7 编译并安装:

命令如下:

$ tar -xzvf Python-3.7.4.tgz
$ cd Python-3.7.4/
$ mkdir build
$cd build
$../configure --prefix=/usr
$make -j8
$sudo make install

错误1:

Failed to build these modules:
_ctypes

解决:

sudo apt-get install libffi-dev

错误2:

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

解决:
下载libressl最新稳定版本 2.7.4
https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.4.tar.gz

解压:

 tar -xzvf libressl-2.7.4.tar.gz

编译安装:

$ cd libressl-2.7.4
$ ./configure
$ make -j8
$ sudo make 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值