Colcon 构建失败,rclpy

发布于 2025-01-17 02:24:14 字数 1096 浏览 4 评论 0原文

尝试 Colcon 构建 ROS2 Rolling (https://docs.ros .org/en/rolling/Installation/Ubuntu-Development-Setup.html),我遇到了这个错误:

colcon build --symlink-install

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,我的系统Ubuntu 20.04。 从日志来看,似乎没有找到 3.8,而选择了 3.9(我的系统上也安装了 3.9)。其他 300 个左右的 ROS2 Rolling 软件包安装没有问题。

Trying to Colcon build ROS2 Rolling (https://docs.ros.org/en/rolling/Installation/Ubuntu-Development-Setup.html), I've faced this error:

colcon build --symlink-install

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]

My system Python is 3.8.10, my system Ubuntu 20.04.
From the logs, it looks like 3.8 is not being found, while 3.9 is picked instead (3.9 is installed too on my system). The other 300s or so packages of ROS2 Rolling installed without issues.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故笙诉离歌 2025-01-24 02:24:14

我相信该错误是由于 colcon 选择了 anaconda python,而不是默认的操作系统 python(在我的例子中是 3.8.10)。

有时 rclpy 导入失败,是因为未找到所需的 C 扩展库。如果是这样,请将目录中存在的库与错误消息中提到的库进行比较。假设存在具有相似名称的文件(具有相同的前缀,如 _rclpy. 和相同的后缀,如 .so,但 Python 版本/体系结构不同),您使用的 Python 解释器与构建 C 扩展所用的解释器不同。请务必使用与构建二进制文件相同的 Python 解释器。

https://docs.ros.org/en/rolling/How-To-Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system

I believe the error was due to colcon picking up the anaconda python, instead of the default OS python (3.8.10 in my case).

Sometimes rclpy fails to be imported because the expected C extension libraries are not found. If so, compare the libraries present in the directory with the one mentioned in the error message. Assuming a file with a similar name exists (same prefix like _rclpy. and same suffix like .so but a different Python version / architecture) you are using a different Python interpreter than which was used to build the C extension. Be sure to use the same Python interpreter as the one used to build the binary.

https://docs.ros.org/en/rolling/How-To-Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文