# 如果使用 django 3.7版本需要安装 libffi-devel,之前版本不需要
yum install libffi-devel sqlite-devel -y
curl -O https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xf Python-3.7.0.tgz
cd Python-3.7.0
./configure
make && make install
sudo apt-get install -y gcc g++ cmake make build-essential zlib1g-dev libbz2-dev libsqlite3-dev libssl-dev libxslt1-dev libffi-dev
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz
tar -zxvf Python-3.9.9.tgz
cd Python-3.9.9/
./configure --prefix=/usr/local/python3.9.9 --enable-loadable-sqlite-extensions --enable-shared
make && sudo make install
# 纯净环境
sudo ln -s /usr/local/python3.9.9/bin/python3 /usr/local/python3.9.9/bin/python3.9.9
sudo ln -s /usr/local/python3.9.9/bin/pip3 /usr/local/python3.9.9/bin/pip3.9.9
export LD_LIBRARY_PATH=/usr/local/python3.9.9/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/python3.9.9/bin:$PATH
# 或者把上面环境变量写入全局环境变量中
source ~/.bashrc