Error when importing tensor stream in embedded python in C ++

I have a question about embedding the Python 3.5 interpreter in a C ++ program to get an image from C ++ and use it as input for my trained tensor flow model. However, if I import the tenorflow library into my python code, I get an error (other libraries are working fine). The simplified code is as follows:

#include <string> #include <windows.h> #include <stdio.h> int main() { Py_InitializeEx(1); PyObject* sysPath = PySys_GetObject((char*)"path"); PyObject* curDir = PyUnicode_FromString("."); PyList_Append(sysPath, curDir); Py_DECREF(curDir); PyRun_SimpleString("import tensorflow\n" "print(tensorflow.__version__)\n"); Py_Finalize(); return 0; } 

And the error:

ConsoleApplication5.exe - ordinal not found

Ordinal 225 cannot be located in the libiomp5md.dll dynamic link library.

Ok

And after clicking OK, this error appears in the console:

Intel MKL FATAL Error: Unable to load mkl_intel_thread.dll file.

My setup is on Windows 7 x64, Anaconda Python 3.5.2, tensorflow-1.1.0, and CUDA 8.

This is a similar problem with a different error.

Thank you for your help.

+1
source share
1 answer

I fixed this problem by copying libiomp5md.dll from the python library folder to my C ++ code directory.

0
source

Source: https://habr.com/ru/post/1271713/


All Articles