环境: centos 7.9
一 、卸载自带python3.7
#卸载python3
rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps
#删除所有残余文件
whereis python3 |xargs rm -frv
#查看现有安装的python,验证是否删除干净
whereis python
二、 安装python3.8 前置依赖
yum install zlib-devel bzip2-devel openssl-devel
三、 安装python3.8
# 下载
wget https://www.python.org/ftp/python/3.8
#解压源码包
tar -zxvf Python-3.8
#创建安装目录
mkdir /usr/local/python3
cd Python-3.8
#安装到指定目录
./configure --prefix=/usr/local/python3
# 编译
make && make install
# 漫长的等待……
# 成功后创建软连接即可全局使用python3了
cd /usr/local/python3
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
安装urllib3
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple urllib3==1.25.11
标签:bin,centos,python,3.8,local,python3,usr
From: https://www.cnblogs.com/rise0111/p/17421706.html