如何修复 ROS/Python ModuleNotFoundError: No module named 'rosbag'
问题
你想运行使用 ROSBag 格式的 Python 脚本,但收到以下错误:
rosbag_import_trace.txt
Traceback (most recent call last):
File "test.py", line 1, in <module>
import rosbag
ModuleNotFoundError: No module named 'rosbag'解决方案
很可能你正在使用 ROS2。rosbag 模块是 ROS1 的一部分,在 ROS2 中不可用 - 直接替代品称为 ros2bag,但你可能需要调整代码来使用它。
而不是
rosbag_import_example.py
import rosbag使用
ros2bag_import_example.py
import ros2bagIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow