2

I have create python static lib (pythoncore.lib) from Python27. It's size 11.2 Mb. I have simple app with python embedded:

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

I use Python/C API to execute python script in programm written on C++. But I want that my programm will work on computers, where Python not installed. For that I want to pack pythoncore.lib in my .exe How I can do this?

5
  • To run your application without a Python installation you will need to distribute the core Python files along with your .exe. Take a look at some of the answers to this question stackoverflow.com/q/1387906/3419537 Commented May 28, 2014 at 16:29
  • @user3419537 I do same thing. But I want to have only one .exe without any additional files. Commented May 28, 2014 at 16:34
  • I'm not sure that's possible. Even tools like py2exe require these additional files alongside the generated .exe Commented May 28, 2014 at 16:47
  • 1
    @user3419537 My instructor sure, that it is possible. And if it's impossible he asks justify it. Commented May 28, 2014 at 16:56
  • Ok, not impossible, but maybe more effort than it's worth :) You will still need to bundle these files within your .exe and provide a means to unpack them such that the Python interpreter can find them. Commented May 28, 2014 at 17:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.