现象
rosrun diagnostic_analysis export_csv.py my.bag -d ~/Desktop
Traceback (most recent call last): File "/opt/ros/noetic/lib/diagnostic_analysis/export_csv.py", line 40, in import roslib; roslib.load_manifest(PKG) File "/opt/ros/noetic/lib/python3/dist-packages/roslib/__init__.py", line 50, in from roslib.launcher import load_manifest # noqa: F401 File "/opt/ros/noetic/lib/python3/dist-packages/roslib/launcher.py", line 42, in import rospkg ImportError: No module named rospkg
pip install rospkg
尝试安装,发现装完了
Looking in indexes: http://pypi.doubanio.com/simple Requirement already satisfied: rospkg in /usr/lib/python3/dist-packages (1.4.0)
原因
解决办法1
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python2 get-pip.py
sudo rm get-pip.py
pip2 install rospkg
解决办法2(推荐)
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 200