在试图构建ROS2滚动(https://docs.ros.org/en/rolling/Installation/Ubuntu-Development-Setup.html)时,我遇到了以下错误:
colcon build --符号链接-安装
Starting >>> rclpy
--- stderr: rclpy
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Python3 (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS
Development) (found version "3.9.10")
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindPython/Support.cmake:2214 (find_package_handle_standard_args)
/usr/share/cmake-3.16/Modules/FindPython3.cmake:300 (include)
CMakeLists.txt:40 (find_package)
---
Failed <<< rclpy [5.33s, exited with code 1]
我的系统Python是3.8.10,我的系统是Ubuntu20.04。从日志中看,似乎没有找到3.8,而选择了3.9 (3.9也安装在我的系统上)。其他300 s左右的ROS2滚动软件包安装时没有问题。
发布于 2022-07-20 08:50:33
我认为这个错误是因为colcon选择了anaconda python,而不是默认的OS (在我的例子中是3.8.10)。
有时无法导入rclpy,因为找不到预期的C扩展库。如果是的话,将目录中的库与错误消息中提到的库进行比较。假设存在具有类似名称的文件(前缀相同,如_rclpy )。同样的后缀,如.so,但不同的Python /架构),您使用的是不同的Python解释器,而不是用于构建C扩展的解释器。确保使用与构建二进制文件相同的Python解释器。
https://stackoverflow.com/questions/71606313
复制相似问题