Ubuntu 升级 安装 python3.11 多版本管理
安装依赖
sudo apt install build-essential checkinstall sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
安装python3.11
安装 add-apt-repository
sudo apt-get install software-properties-common
添加 ppa 并安装
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install python3.11
查看 python 版本
# python3.11 -V Python 3.11.1 # python3 -V Python 3.8.2
将python3.11设为默认 python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
将python3指向 python3.11
# sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/python3.11 2 auto mode 1 /usr/bin/python3.11 2 manual mode 2 /usr/bin/python3.8 1 manual mode Press <enter> to keep the current choice[*], or type selection number: # 选择 python 版本
验证 python3
# python3 -V Python 3.11.3
安装pip3
用包安装,不会自动安装pip3
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
查看 pip 版本
# pip3 -V pip 23.1 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
0顶
0 踩
共 0 条评论