本文档适用 Python 3.9及以上版本。
1. 提前安装依赖
yum install -y gcc ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel openssl11 openssl11-devel
2. 设置编译 FLAG
- AWS AMI:
export CFLAGS=$(pkg-config --cflags libssl11)
export LDFLAGS=$(pkg-config --libs libssl11)
- CentOS:
export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)
3. 编译安装 Python3
cd src
wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tar.xz
tar xf Python-3.11.3.tar.xz
cd Python-3.11.3
./configure --prefix=/App/python --disable-test-modules
make -j$(nproc)
make install
echo 'export PATH=/App/python/bin:$PATH' >> /etc/profile
source /etc/profile
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net