centos7.5安装python3.8

1.安装依赖

yum -y install yum-utils
yum-builddep python

2.下载python

wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz

3.编译python

tar -xvf Python-3.8.6.tar.xz
cd Python-3.8.6
./configure
make 
make install

4.配置默认使用python3

vi /etc/profile.d/python.sh
alias python='/usr/local/bin/python3.8'
source /etc/profile.d/python.sh

5.下载pip

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py -i https://pypi.tuna.tsinghua.edu.cn/simple/

6.配置pip源

方法一:

# 设置pip默认源
# 安装pqi
pip install pqi
# 查看支持的镜像
pqi ls 
# 查看当前使用的镜像
pqi show
# 设置aliyun为默认镜像
pqi use aliyun

方法二:

# 阿里云内网pip地址
vi ~/.pip/pip.conf
[global]
index-url = http://mirrors.cloud.aliyuncs.com/pypi/simple/
[install]
trusted-host = mirrors.cloud.aliyuncs.com

# 外网
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
如果觉得我的文章对你有用,请随意赞赏