views:

821

answers:

2

I plan to use PyInstaller to create a stand-alone python executable. PythonInstaller comes with built-in support for UPX and uses it to compress the executable but they are still really huge (about 2,7 mb).

Is there any way to create even smaller Python executables? For example using a shrinked python.dll or something similiar?

+7  A: 

If you recompile pythonxy.dll, you can omit modules that you don't need. Going by size, stripping off the unicode database and the CJK codes creates the largest code reduction. This, of course, assumes that you don't need these. Remove the modules from the pythoncore project, and also remove them from PC/config.c

Martin v. Löwis
A: 

You can't go too low in size, because you obviously need to bundle the Python interpreter in, and only that takes a considerable amount of space.

I had the same concerns once, and there are two approaches:

  1. Install Python on the computers you want to run on and only distribute the scripts
  2. Install Python in the internal network on some shared drive, and rig the users' PATH to recognize where Python is located. With some installation script / program trickery, users can be completely oblivious to this, and you'll get to distribute minimal applications.
Eli Bendersky