使用静态Python(pythoncore.lib文件)

2024-05-14 11:09:34 发布

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

我已经创建了python静态库(pythoncore.lib文件)从Python27。它的大小是11.2MB。我有一个嵌入python的简单应用程序:

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


int main()
{
Py_Initialize();
PyRun_SimpleString("print 'Hello World'");
PyRun_SimpleString("for i in range(5):\n"
"\tprint i,\n");

Py_Finalize();
getch();
return 0;
}
< P>使用Python /C API在C++编写的程序中执行Python脚本。但我希望我的程序能在没有安装Python的计算机上运行。为此我想打包pythoncore.lib文件在我的.exe里我怎么能做到这一点?你知道吗


Tags: 文件py程序应用程序includelib静态mb

热门问题