I have spent a good part of my day trying to run a Python file from c++. I have tried:
. . .
FILE * file = fopen ("file.py", "r");
PyRun_SimpleFile (file, "file.py");
. . .
This however just causes my application to crash. I am using python version 3.4.
Try
Py_Initialize();
PyRun_SimpleFile (file, "file.py");
Py_Finalize();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.