确定现有python路径
which python
return:
/usr/local/bin/python
确定需要使用的python路径
查找2.7
which python2.7
return:
/usr/bin/python2.7
查找3.6
which python3.6
return:
/usr/bin/python3.6
查找3.8
which python3.8
return:
/usr/local/python3/bin/python3.8
指定不同版本顺序
sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3.6 2
sudo update-alternatives --install /usr/local/bin/python python /usr/local/python3/bin/python3.8 3
指定所需版本号
sudo update-alternatives --config python
输入序号即可。