ROS----python版本切换

切换python版本,编译cv_bridge需要先切换到python3

echo alias python=python3 >> ~/.bashrc
source ~/.bashrc

借助命令切换python3

update-alternatives --display python

update-alternatives: 错误: 无 python 的候选项

先建立python的组,并添加Python2和Python3的可选项
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 # 添加Python2可选项,优先级为1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2 #添加Python3可选项,优先级为2
用命令切换python版本:

sudo update-alternatives --config python

你可能感兴趣的:(ROS,python)