首页 > 其他分享 >(笔记)ROS2 colcon build报错:ModuleNotFoundError: No module named ‘catkin_pkg‘

(笔记)ROS2 colcon build报错:ModuleNotFoundError: No module named ‘catkin_pkg‘

时间:2022-11-03 09:58:45浏览次数:54  
标签:xml core named colcon package 报错 fishbot ament cmake

 

在使用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”,它应该就是这个罪魁祸首了!

 

标签:xml,core,named,colcon,package,报错,fishbot,ament,cmake
From: https://www.cnblogs.com/tdyizhen1314/p/16853418.html

相关文章