Ubuntu安装python3
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.10
python3.10 --version
安装pip
apt install python3-pip
将Python 3.10设置为默认的Python 3版本
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --config python3
编译安装
sudo apt install wget build-essential checkinstall
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev
cd Python-3.10.0
sudo ./configure --enable-optimizations
sudo make -j $(nproc)
sudo make altinstall
创建软链接
sudo ln -s /usr/local/bin/python3.10 /usr/bin/python3
配置 pip3
sudo ln -s /usr/local/bin/pip3.10 /usr/bin/pip3