roscore显示未安装,实则已安装

(1)错误:
roscore运行显示未安装
roscore显示未安装_其他

按提示安会报错,
roscore显示未安装_重新编译_02
但实际上已安装

(2)解决办法:

vim ~/.bashrc

删除source /opt/ros/melodic/setup.bash保存与退出
终端重新编译

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

再按roscore可以启动。