1、下载依赖
sudo apt install -y wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
2、上传文件 ,解压并进入
tar -xf Python-3.11.0.tar.xz
3、编译
cd Python-3.11.0/
./configure --enable-optimizations
make && sudo make altinstall
4、设置默认解释器
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.11 100
5、查看版本
python3 --version
6、设置pip
ln -s /usr/local/bin/pip3.11 /usr/bin/pip