本文档适用 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
标签:Python,--,3.11,devel,编译,export,pkg,Linux,Python3
From: https://blog.51cto.com/dongsong/6210553