python37.dll未在可执行文件中链接 [英] python37.dll not linked in executable

查看:312
本文介绍了python37.dll未在可执行文件中链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用python扩展了c ++,但是exectuable不能在没有安装python的系统上运行.

I extended c++ with python but the exectuable won't run on systems that do not have python installed.

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

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

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

When I run on a windows system without python installed I receive the following error:

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

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

How do I link python37.dll to the executable.

推荐答案

DLL的定义是一个动态链接的库,它是一个单独的模块,可以在运行时进行查找和解析.

A DLL is by definition a dynamically linked library, it is a separate module that is looked up and resolved at run time.

如果未安装Python,则您的应用程序将无法运行.

If Python is not installed, your application won't run.

您需要将Python与应用程序捆绑在一起,或者在安装应用程序之前/期间安装Python.

You need to either bundle Python with your application or install Python before/during your application installation.

或者,您可以尝试使用Python 静态链接,在这种情况下,它将成为Python的一部分可执行文件,不需要单独安装.

Alternatively you can try linking with Python statically, in which case it will become part of the executable and won't need to be installed separately.

这篇关于python37.dll未在可执行文件中链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆