1. fatal error: ‘Python.h’ file not found
在编译进pybind11的时候,#include<pybind11.pybind11.h>
, 报这个错。在CMakeLists.txt中加入Python.h所在的目录就好。因为我装了anaconda,所以"/Users/****/opt/anaconda3/include/python3.8")下有。所以在CMakeLists.txt中加入如下语句就能解决这个问题。
set(Python_INCLUDE_DIR "/Users/*****/opt/anaconda3/include/python3.8")
target_include_directories(hello_pybind PUBLIC Python_INCLUDE_DIR)