python3.10安装

python3.10 安装

0. 我的环境

[root@ftp ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@ftp ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
[root@ftp ~]#

1. centos7.6 安装python3需要升级openssl

[root@ftp ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

[root@ftp ~]# yum install -y ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel

[root@ftp ~]# yum install -y openssl-devel openssl11 openssl11-devel

[root@ftp ~]# openssl11 version
OpenSSL 1.1.1k  FIPS 25 Mar 2021

2. 安装python3

python下载地址:https://www.python.org/ftp/python/

[root@ftp ]# mkdir -p /doc/temp && cd /doc/temp
[root@ftp temp]# wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz

#注意:编译时需要使用最新openssl库
[root@ftp Python-3.10.14]# export CFLAGS=$(pkg-config --cflags openssl11)
[root@ftp Python-3.10.14]# export LDFLAGS=$(pkg-config --libs openssl11)

#验证是否生效
[root@ftp Python-3.10.14]# echo $CFLAGS
-I/usr/include/openssl11
[root@ftp Python-3.10.14]# echo $LDFLAGS
-L/usr/lib64/openssl11 -lssl -lcrypto


[root@ftp temp]# tar xf Python-3.10.14.tgz
[root@ftp temp]# cd Python-3.10.14

#编译
[root@ftp Python-3.10.14]# ./configure --enable-optimizations && make altinstall




#配置软连接
[root@ftp Python-3.10.14]# ln -sf /usr/local/bin/python3.10 /usr/bin/python3
[root@ftp Python-3.10.14]# ln -sf /usr/local/bin/pip3.10 /usr/bin/pip3

3. 查看python3版本

[root@ftp Python-3.10.14]# python3 --version
Python 3.10.14
[root@ftp Python-3.10.14]# pip3 --version
pip 23.0.1 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值