【问题标题】:cannot run Py_Initialize(), application exited with code -1073741191无法运行 Py_Initialize(),应用程序以代码 -1073741191 退出
【发布时间】:2021-12-02 02:04:06
【问题描述】:

我目前正在测试将 Python 嵌入到 C 应用程序中,但是我根本无法让它工作。我可以很好地构建它,但运行它不会返回错误,只有退出状态为 -1073741191 的应用程序错误。

这是我的代码:

#define PY_SSIZE_T_CLEAN

#include <stdlib.h>
#include <stdio.h>

#ifdef _DEBUG
#undef _DEBUG
#include <C:\Users\name\anaconda3\include\Python.h>
#define _DEBUG
#else
#include <C:\Users\name\anaconda3\include\Python.h>
#endif
int
main(int argc, char* argv[])
{
    printf("dummy");
    Py_Initialize();
    Py_Finalize();

  
    return 0;
}

在链接器中,额外的库目录:我放置了 python38.lib 的路径。网上查了一下,退出码状态没有任何意义,也没有什么问题,只有明显构建成功后的应用报错。

【问题讨论】:

    标签: python c embedding cpython


    【解决方案1】:

    解决了,我只是没有在我的项目中包含 python .dll 文件

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-12
      • 2018-04-24
      • 2013-03-24
      • 1970-01-01
      相关资源
      最近更新 更多