(笔记)ROS2 colcon build报错:ModuleNotFoundError: No module named ‘catkin_pkg‘
在使用ROS2时,使用colcon build编译时,报错如下:
1 Starting >>> fishbot_navigation2 2 --- stderr: fishbot_navigation2 3 Traceback (most recent call last): 4 File "/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 21, in <module> 5 from catkin_pkg.package import parse_package_string 6 ModuleNotFoundError: No module named 'catkin_pkg' 7 CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:94 (message): 8 execute_process(/home/ros2/miniconda3/bin/python3 9 /opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py 10 /home/ros2/code/fishbot_ws/src/fishbot_navigation2/package.xml 11 /home/ros2/code/fishbot_ws/build/fishbot_navigation2/ament_cmake_core/package.cmake) 12 returned error code 1 13 Call Stack (most recent call first): 14 /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml) 15 /opt/ros/foxy/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml) 16 CMakeLists.txt:34 (ament_lint_auto_find_test_dependencies) 17 18 19 --- 20 Failed <<< fishbot_navigation2 [0.29s, exited with code 1] 21 22 Summary: 0 packages finished [0.42s] 23 1 package failed: fishbot_navigation2 24 1 package had stderr output: fishbot_navigation2
解决方法:
pip3 install catkin_pkg
再次colcon build,成功了!因为此问题困住了好长时间,以前同样的方式没有任何问题,但突然新的工程都没法编译,而唯一的变化就是最近新安装了“conda”,它应该就是这个罪魁祸首了!
作者:tdyizhen1314(一位从事软硬件开发十年以上的老兵的故事,希望与大家一起交流,共同进步)
邮箱:495567585@qq.com
posted on 2022-11-03 09:46 tdyizhen1314 阅读(1733) 评论(0) 编辑 收藏 举报