소스 검색

HPCC-16487 Can't import tensorflow in embedded python

Set up fake argc/argv in case any python code (such as tensorflow) assumes it
is present.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 년 전
부모
커밋
d149ad6561
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      plugins/pyembed/pyembed.cpp

+ 2 - 0
plugins/pyembed/pyembed.cpp

@@ -274,6 +274,8 @@ public:
 #endif
         // Initialize the Python Interpreter
         Py_Initialize();
+        const char *argv[] = { nullptr };
+        PySys_SetArgvEx(0, (char **) argv, 0);
         PyEval_InitThreads();
         tstate = PyEval_SaveThread();
         initialized = true;