You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译Python3版本geometry2时出现CMake错误的解决方法求助

Fixing "No rule to make target '/usr/lib/python3.6/config/libpython3.6.so'" in geometry2 tf2_py Build

This error pops up because CMake can’t locate the Python 3.6 shared library at the path it’s expecting. Let’s walk through practical fixes step by step:

Step 1: Find where your system stores libpython3.6.so

First, run this command to locate the actual library file on your machine:

find /usr/lib -name "libpython3.6.so"

You’ll likely get a path like /usr/lib/x86_64-linux-gnu/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so (the exact path depends on your distro and architecture).

Step 2: Fix the path mismatch

You have two reliable options here:

Link the actual library to the path CMake is looking for:

sudo ln -s /path/to/your/libpython3.6.so /usr/lib/python3.6/config/libpython3.6.so

Replace /path/to/your/libpython3.6.so with the path you found in Step 1.

Option B: Specify the library path directly in catkin_make

Instead of modifying system paths, pass the correct library path to CMake during the build:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so

Note: Some systems use libpython3.6m.so (with the m suffix for pymalloc support) instead of libpython3.6.so — adjust the path to match what your find command returned.

Step 3: Ensure Python 3.6 dev files are installed

If the library file doesn’t exist at all, you’re probably missing the Python development package. Install it with:

sudo apt-get install python3.6-dev

After trying one of these fixes, clean your build directory and rebuild to apply changes:

cd ~/geometry2_ws
catkin clean
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

Why this happens

On modern 64-bit systems, Python’s development libraries are often stored in architecture-specific subdirectories (like x86_64-linux-gnu) instead of the older /usr/lib/python3.6/config path. The tf2_py CMake configuration might be hardcoded to this outdated path, leading to the missing target error.

内容的提问来源于stack exchange,提问作者sudo-Boris

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 17:07:42