linux安装python3.7.3

从www.python.org下载源码包
三步安装
./configure 或者./configure --enable-optimizations或者 ./configure --enable-optimizations --with-ssl --prefix=/usr
make
make install
make install碰到这个问题
ModuleNotFoundError: No module named ‘_ctypes’

需要安装依赖包

yum -y groupinstall "Development tools"

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

下面这个包也需要安装
 yum install libffi-devel -y

 yum install libffi -y

安装完这些软件包后,需要重新解压python源码包,然后重新configure make make install

再make install的时候发现/usr/local为只读文件系统,修改 Makefile,将里面的/usr/local 替换为/usr,就可以安装成功
make过程中报下面这个错
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

这个是因为python3.7.3 需要openssl 1.0.2,而默认机器上安装的版本是1.0.1
参考这个帖子,安装openssl的新版本
http://www.lingdonge.com/daily/4176.html
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
./config --prefix=/usr
make
make install
[root@linux1 Python-3.7.3]# openssl version
OpenSSL 1.0.2j  26 Sep 2016

然后重新./configure 
make 
make install
三步安装python3.7.3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值