在阿里云下载python二进制版本

1.国内加速下载 Python 3.9

VPC内网下载地址

阿里云 Python 镜像其实只是 官方仓库的同步缓存

flowchart LR
A[python.org release] --> B[阿里云 mirror]
B --> C[国内服务器 wget]
  • 内容完全一样
  • 下载速度更快
  • 适合 CI / 内网环境

3.9系列目前常用稳定版:

1
2
3
4
5
wget https://mirrors.aliyun.com/python-release/source/Python-3.9.19.tgz

wget https://mirrors.aliyun.com/python-release/source/Python-3.9.25.tgz

wget http://mirrors.cloud.aliyuncs.com/python-release/source/Python-3.9.19.tgz

2.编译完整命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
yum install -y gcc gcc-c++ make \
openssl-devel bzip2-devel libffi-devel \
zlib-devel readline-devel sqlite-devel \
xz-devel expat-devel

wget https://mirrors.aliyun.com/python-release/source/Python-3.9.19.tgz

tar xf Python-3.9.19.tgz
cd Python-3.9.19

./configure \
--prefix=/local/python3.9 \
--enable-optimizations \
--enable-shared \
--with-system-expat=no

make -j$(nproc)
make install

⚠️:实际centos gcc不支持构建py3.9,必须升级gcc