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?

Dmitry_Mahrachev
  • 279
  • 1
  • 2
  • 8
  • 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 http://stackoverflow.com/q/1387906/3419537 – user3419537 May 28 '14 at 16:29
  • @user3419537 I do same thing. But I want to have only one .exe without any additional files. – Dmitry_Mahrachev May 28 '14 at 16:34
  • I'm not sure that's possible. Even tools like py2exe require these additional files alongside the generated .exe – user3419537 May 28 '14 at 16:47
  • 1
    @user3419537 My instructor sure, that it is possible. And if it's impossible he asks justify it. – Dmitry_Mahrachev May 28 '14 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. – user3419537 May 28 '14 at 17:10

0 Answers0