1.安装python3.6
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
2.设置python3.6优先
(1) 查看优先级
sudo update-alternatives --config python
若报错,则表明没有设定过优先级
(2)设定优先级
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
上面的例子是,设定python3.8的优先级是1,设定python3.6的优先级是2, 优先级越高,数字越大的在终端输入python时会先被执行。
3.安装pip
curl https://bootstrap.pypa.io/ez_setup.py -o - | python3.6 && python3.6 -m easy_install pip
或
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" python3 get-pip.py --user
4.卸载
sudo apt autoremove python3.6
|