Hi, I'm using Python 3.6 in a C ++ application. (Mingw 5.3 and GDB 7.10.1).
main.cpp :
My problem is with Debug launch (with GDB).
main.cpp :
#include <include/Python.h> int main(int argc, char *argv[]) { wchar_t *program = Py_DecodeLocale(argv[0], NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); exit(1); } Py_SetProgramName(program); //optional but recommended Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print('Today is', ctime(time()))\n"); if (Py_FinalizeEx() < 0) { exit(120); } PyMem_RawFree(program); return 0; }project.pro :
LIBS += "D:\Python 3.6.3\libs\libpython36.a"INCLUDEPATH += "D:\\Python 3.6.3\\"DEPENDPATH += "D:\\Python 3.6.3\\" QMAKE_CXXFLAGS += -D_hypot=hypotThis code works perfectly in release.
My problem is with Debug launch (with GDB).
Error:Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00002f24 (most recent call first):
Fatal Python error:
Py_Initialize: unable to load the file system codec
Thank you