1. 熟悉官网及安装python
https://www.python.org/
安装python
1. yum-builddep python3 -y
安装依赖:
yum groupinstall "Development tools" -y
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel -y
因为需要安装openssl11 openssl11-devel(python3.11 需要这个openssl软件十一版本),否则会报错:
//1. 可能需要先执行
yum update -y
//2. 然后
yum install -y epel-release
//3. 安装
yum install -y openssl-devel openssl11 openssl11-devel
#解压缩安装包
yum -y install gcc zlib zlib-devel libffi libffi-devel
#安装源码编译需要的编译环境
yum install readline-devel
#可以解决后期出现的方向键、删除键乱码问题,这里提前避免。
yum install openssl-devel openssl11 openssl11-devel
#安装openssl11,后期的pip3安装网络相关模块需要用到ssl模块。
export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)
#设置编译FLAG,以便使用最新的openssl库
2. 下载安装包
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
3. 解压
tar -zxf Python-3.11.4.tgz
4. 安装:configure && make & make install
4.1 执行 ./configure --prefix='/opt/python/install3114'
4.2 执行make命令
4.3 执行make install命令
4.5 创建软连接
ln -s /opt/python/install3114/bin/* /usr/local/bin/
标签:python,devel,Centos7,yum,openssl11,install,安装 From: https://www.cnblogs.com/allenxx/p/17473266.html