Running python script in cpp [closed]

asked 2021-02-18 14:23:52 -0500

RB_Code gravatar image

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();
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by jayess
close date 2021-02-18 16:33:10.694867

Comments

I closed your question because it seems like it's more of a C++ problem instead of a ROS-related problem. If you update it to be a ROS-related problem then we reopen it. With over 57,000 questions on the site we try to keep them focused on issues related to ROS

jayess gravatar image jayess  ( 2021-02-18 16:34:46 -0500 )edit