Running python script in cpp

  action, c++, python, ros

I’m trying to run a python script inside a cpp file but it doesn’t recognise the python library: fatal error: Python.h: No such file or directory.

I’m including the library in the makefile like this: ${PYTHON_INCLUDE_DIRS}

Any idea what might be missing?

char filename[] = "/scripts/arm_activate.py";
  FILE* fp;
  Py_Initialize();
  fp = _Py_fopen(filename, "r");
  PyRun_SimpleFile(fp, filename);

  Py_Finalize();

Source: Windows Questions C++

LEAVE A COMMENT