python37.dll 未链接到可执行文件中

2024-04-26

我用 python 扩展了 c++,但可执行文件无法在未安装 python 的系统上运行。

#include "C:\.....python.h"

int main()
{
    Py_Initialize();
    PyRun_SimpleString("print("hello world")\n")
Py_Finalize();
return 0;
}

当我在没有安装 python 的 Windows 系统上运行时,我收到以下错误:

The code execution cannot proceed because python37.dll was not found. Reinstalling the program may fix the problem.

如何将 python37.dll 链接到可执行文件。


确保您的 python 文件夹位于您的 PATH 中,以便它可以找到有问题的 DLL。

从命令行:

c:\> set PATH=c:\python\python37;%PATH%
c:\> cd /d c:\path\to\your\exe
c:\path\to\you\exe> myprogram.exe

有关如何查找和加载 DLL 的更多详细信息,请阅读MSDN 上的动态链接库搜索顺序页面 https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python37.dll 未链接到可执行文件中 的相关文章

随机推荐