下载
# 安装依赖
[root@localhost ~]# 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 libffi-devel
# 下载 Python 3.8 【可以用讯雷下好,拖到 Linx 中】
[root@localhost ~]# wget https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz
[root@localhost ~]# tar -zxvf Python-3.8.10.tgz
安装
[root@localhost ~]# cd Python-3.8.10
# 配置安装路径,
[root@localhost Python-3.8.10]# ./configure prefix=/usr/local/python3
# 编译安装python3
[root@localhost Python-3.8.10]# make && make install
# 将原来的链接备份
[root@localhost Python-3.8.10]# mv /usr/bin/python /usr/bin/python2.7.bak
# 添加python3的软链接
[root@localhost Python-3.8.10]# ln -s /usr/local/python3/bin/python3 /usr/bin/python
[root@localhost Python-3.8.10]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
# 测试是否安装成功了
[root@localhost Python-3.8.10]# python -V
Python 3.8.10
[root@localhost Python-3.8.10]# pip -V
pip 21.1.1 from /usr/local/python3/lib/python3.8/site-packages/pip (python 3.8)
标签:10,Python,devel,升级,Python3,Linux,root,3.8,localhost
From: https://www.cnblogs.com/vipsoft/p/17409174.html