Python.h not found while building sample application with cmake and pybind11

前端 未结 2 1733
情话喂你
情话喂你 2020-12-19 20:51

I want to build simple app with pybind11, pybind is already installed in my Ubuntu system with cmake (and make install). I use this simple cmake file:

cmake_         


        
2条回答
  •  庸人自扰
    2020-12-19 20:54

    You'll want to use the pybind11_add_module command (see https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake) for the default case of creating an extension module.

    If the goal is indeed to embed Python in an executable, it is your reponsibility to explicitly add python headers & libraries to the compiler/linker commands in CMake. (see https://pybind11.readthedocs.io/en/stable/compiling.html#embedding-the-python-interpreter on how to do that)

提交回复
热议问题