今天在启动rviz时发生一个很奇怪的报错:
rviz: error while loading shared libraries: librviz.so: cannot open shared object file: No such file or directory
我感觉很纳闷!再试着启动一下roscore,发现如下报错:
[rosout-1] process has died [pid 5589, exit code 127, cmd /opt/ros/noetic/lib/rosout/rosout __name:=rosout __log:=/home/hjx/.ros/log/a367df56-12cf-11ef-aeee-47c0072ffa95/rosout-1.log].
log file: /home/hjx/.ros/log/a367df56-12cf-11ef-aeee-47c0072ffa95/rosout-1*.log
我已经裂开,心里想着ros用着用着还能消失?于是查看了.bashrc文件的环境变量:
发现环境变量是存在的,我已经不知所措了这时候!
一个神奇的解决方法被我不经意之间尝试了出来,就是将上面红色方框的环境变量移动至最后:
保存后再次执行roscore,发现恢复了正常:
哦~~~这可正是一个玄学~