报错内容
Base path: /home/lab107/catkin_ws
Source space: /home/lab107/catkin_ws/src
Build space: /home/lab107/catkin_ws/build
Devel space: /home/lab107/catkin_ws/devel
Install space: /home/lab107/catkin_ws/install
####
#### Running command: "cmake /home/lab107/catkin_ws/src -DPYTHON_EXECUTABLE=/usr/bin/python2 -DCATKIN_DEVEL_PREFIX=/home/lab107/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/lab107/catkin_ws/install -G Unix Makefiles" in "/home/lab107/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/lab107/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find PythonInterp: Found unsuitable version "2.7.18", but
required is at least "3" (found /usr/bin/python2)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindPythonInterp.cmake:169 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/opt/ros/noetic/share/catkin/cmake/python.cmake:4 (find_package)
/opt/ros/noetic/share/catkin/cmake/all.cmake:164 (include)
/opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:58 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/lab107/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/lab107/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
报错原因
这个错误表明在运行catkin_make
时,CMake 无法找到符合 ROS 的 Python 版本要求的解释器。ROS Noetic 要求使用 Python 3,但我的系统中的为Python2.7。
解决方法
手动指定 Python 版本使用Python3。
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3