ubuntu18.04 ros版本管理melodic/dashing
bashrc内容如下:
source /opt/ros/melodic/setup.bash
#source /opt/ros/dashing/setup.bash
export ROS_DISTRO=melodic
export PKG_CONFIG_PATH=~/opencv-3.4.4/build/installed/lib/pkgconfig
export LD_LIBRARY_PATH=~/opencv-3.4.4/build/installed/lib
export PATH=${PATH}:/opt/ros/melodic/lib
export ROS_HOSTNAME=127.0.0.1
export ROS_IP=127.0.0.1
if [ -f /opt/ros/melodic/setup.bash ]; thensource /opt/ros/melodic/setup.bash
elif [ -f /opt/ros/dashing/setup.bash ]; thensource /opt/ros/dashing/setup.bash
elseecho "No ros distro found!"
fi
需要注意的是melodic需要的python版本为2.7
修改ubuntu默认python版本的方法如下:
update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.6
设置优先级 数字越高优先级越大
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2