Ubuntu 16
参阅:
https://www.cnblogs.com/hellojesson/p/11394458.html https://blog.csdn.net/qq_35975447/article/details/106795935
1.安装add-apt-repository 命令
apt install python-software-properties # 这个或许不是必须的,只要下面一句即可
apt install software-properties-common
2.添加python3.6 到apt仓库:
add-apt-repository ppa:deadsnakes/ppa
3.更新系统
apt update
4.执行安装
apt install python3.6
5.切换默认版本
cd /usr/bin
rm -rf python python3
ln -s python3.6 python
ln -s python3.6 python3
6.安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # 下载安装脚本
python get-pip.py #使用哪个 Python 运行脚本,就会给哪个Python安装 pip
7.验证
pip -V
pip 20.3.3 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
Ubuntu18
1.更新系统
apt update
2.安装Python
apt install python3.6
3.查看Python版本
python3.6 -V
4.安装pip
apt install python3-pip
5.验证
pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)