在c中导入嵌入式python中的tensorflow时出错++

2024-05-08 15:37:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题是在C++程序中嵌入Python 3.5解释器,从C++接收图像,并将其作为输入的训练后的张量流模型。当我在python代码中导入tensorflow库时,我得到一个错误(其他库工作正常)。简化代码如下:

#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;
}

错误是:

ConsoleApplication5.exe - Ordinal Not Found

The ordinal 225 could not be located in the dynamic link library libiomp5md.dll.

OK

按“确定”后,控制台中出现此错误:

Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.

我的设置是在Windows7x64、AnacondaPython3.5.2、tensorflow-1.1.0和CUDA8上进行的。在

This是一个具有不同错误的类似问题。在

谢谢你的帮助。在


Tags: 代码py模型图像程序stringincludewindows

热门问题