1、安装依赖关系:
yum -y install zlib-devel xz-devel bzip2 -devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make |
2、下载源码包
cd /alidata/tmp wget -c https://www.python.org/ftp/python/3.9.12/Python-3.9.12.tgz |
3、解压、编译、安装
# 解压
tar
-xzvf ./Python-3.9.12.tgz
# 编译
cd
Python-3.9.12
./configure
--enable-optimizations
# 安装
make
altinstall # 跳过创建python链接和手册页链接的操作
# 建立软连接
|
4、检测版本
python3 -V # 查看python版本
pip3 list # 查看pip3是否安装成功
5、永久设置pip3为国内镜像
全局设置:
pip3 config
set
global.index-url https:
//mirrors
.aliyun.com
/pypi/simple
pip3 config
set
install
.trusted-host https:
//pypi
.tuna.aliyun.com
/pypi/simple
python3 -m pip installpip -U
查看配置:
# pip3 config list
global.index-url=
'https://mirrors.aliyun.com/pypi/simple'
install
.trusted-host=
'https://pypi.tuna.aliyun.com/pypi/simple'
Comments NOTHING