ubuntu20.4中ros2版本,colcon build编译报错如下:
Starting >>> fishbot_navigation2
--- stderr: fishbot_navigation2
Traceback (most recent call last):
File "/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 21, in <module>
from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:94 (message):
execute_process(/home/ros2/miniconda3/bin/python3
/opt/ros/foxy/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
/home/ros2/code/fishbot_ws/src/fishbot_navigation2/package.xml
/home/ros2/code/fishbot_ws/build/fishbot_navigation2/ament_cmake_core/package.cmake)
returned error code 1
Call Stack (most recent call first):
/opt/ros/foxy/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
/opt/ros/foxy/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:31 (ament_package_xml)
CMakeLists.txt:34 (ament_lint_auto_find_test_dependencies)
---
Failed <<< fishbot_navigation2 [0.29s, exited with code 1]
Summary: 0 packages finished [0.42s]
1 package failed: fishbot_navigation2
1 package had stderr output: fishbot_navigation2
解决方案如下:
pip3 install catkin_pkg
或者
pip install catkin_pkg