Embedding python in C++, Segmentation fault
问题 I am trying to embed python script in a c++ application. To try out the integration, I made a pilot code: // c++ code int main(int argc, char *argv[]) { PyObject *pName, *pModule, *pDict, *pFunc, *pValue; if (argc < 3) { printf("Usage: exe_name python_source function_name\n"); return 1; } // Initialize the Python Interpreter Py_Initialize(); // Build the name object pName = PyBytes_FromString(argv[1]); //std::to_string(argv[1]).encode( // Load the module object pModule = PyImport_Import(pName