how to invoke python script in c++ code? -
in c++
application, want invoke python
script processing works. have searched in google , found there 2 ways this:
(1). use `system` command. this, `system('python myscript.py');` (2). use `pyrun_simplestring("execfile('myscript.py')");`
i want ask that, way better , there better way work?
thanks.
i want ask that, way better , there better way work?
you should notice python engine written in c , therefore provides native c-api. allows interact more directly python code, means of calling functions , using python objects.
if want integrate c++ code without hassling c-api, there's excellent , easy use boost::python library.
Comments
Post a Comment