ubuntu20.04 LCM源码编译安装找不到python.h的解决方法
ubuntu20.04 LCM源码编译安装找不到python.h的解决方法

Warning: Trying to access array offset on value of type null in /www/wwwroot/cennum_top/wp-content/themes/bravada/includes/loop.php on line 341

ubuntu20.04 LCM源码编译安装找不到python.h的解决方法

找到lcm文件夹的lcmpython文件夹,修改CMakeLists.txt,将原来的替换如下

if (WIN32)
  find_package(Python COMPONENTS Interpreter Development)

  target_include_directories(lcm-python PRIVATE
    ${Python_INCLUDE_DIRS}
  )
else ()
  find_package(Python3 COMPONENTS Interpreter Development.Module)

  target_include_directories(lcm-python PRIVATE
    ${Python3_INCLUDE_DIRS}
  )
endif ()

替换为


if (WIN32)
  find_package(Python COMPONENTS Interpreter Development)
  target_include_directories(lcm-python PRIVATE ${Python_INCLUDE_DIRS})
else ()
  # 直接使用你系统中 Python3.8 的头文件路径
  set(Python3_INCLUDE_DIRS "/usr/include/python3.8")
  set(Python3_LIBRARIES "/usr/lib/x86_64-linux-gnu/libpython3.8.so")
  
  target_include_directories(lcm-python PRIVATE ${Python3_INCLUDE_DIRS})
  target_link_libraries(lcm-python PRIVATE ${Python3_LIBRARIES})
endif ()

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注