Centos7.9编译安装Python3.9

这里以python3.9.9为例

安装系统依赖

yum install bzip2-devel ncurses-devel sqlite-devel gdbm-devel xz-devel tk-devel readline-devel openssl-devel libffi-devel gcc make -y

解压

tar -xvf Python-3.9.9.tar.xz
cd Python-3.9.9

配置

./configure --prefix=/usr/local/python3.9.9

### 开启ssl
```bash
vim Modules/Setup

去除如下内容的注释即可

SSL=/usr/local/ssl
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

编译安装

make
make install

软链接到/usr/local/bin下面

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

安装完成!

posted @ 2022-02-10 22:19  GreeneGe  阅读(677)  评论(0编辑  收藏  举报

https://github.com/Glf9832