Even after adding -DPYTHON_INCLUDE_DIR
and -DPYTHON_LIBRARY
as suggested above, I was still facing the error Could NOT find PythonInterp
. What solved it was adding -DPYTHON_EXECUTABLE:FILEPATH=
to cmake
as suggested in https://github.com/pybind/pybind11/issues/99#issuecomment-182071479:
cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") \
-DPYTHON_EXECUTABLE:FILEPATH=`which python`