Springe zum Hauptinhalt

Distributing Python programms for Windows using pyinstaller

While I not blogged on this topic yet, for several times now I looked into the topic of how to distribute Python for Windows users. There are several major problems, especially if one wants to cross-bundle from e.g. Linux. The later is a requirement for me, since my development platform is Linux and I do not want to boot into Windows just for creating a new distribution package.

With "cross-bundling" I mean "just" sticking together pure python programs, eventually with already compiled third-party packages like GTK. So one of the problems may be where to get the binary packages from. But I'll not going into this today.

The program I want to distribute is my pdfposter, which scales and tiles PDF images/pages to print on multiple pages. Basically this is a Python script, a Python package and another Python package (pyPDF). On a Unix system, installing it is quite easy, assuming that Python is already installed (which is the case on Linux).

Not so on WIndows!

On Windows users are used to get self-contained packages. For installing pdfposter, one needs to install Python, setuptools, (maybe pyPDF, if you are offline) and then pdfposter. Users get trapped be the provided .msi and pdfposter got horrible comments on Heise Software Verzeichnis. So I decided to release a Windows executable of pdfposter for the next release.

In 2008 I already did some work on pyinstaller, adding support for different target-platform and for relative imports (see this trak timeline). One of the major pros of pyinstaller is: the binaries required for bootstraping the program on the target platform are included prebuild. So one may really bundle cross platform.

Meanwhile, a lot has been worked on pyinstaller and it is now able to include Python eggs (this is packages packed into a zip-file or unpacked into a directory). Wow! py2exe (one of the major other options) still does not support this. There is still some more work to do until can use pyinstaller. [Now it's getting technical] Currently scripts defined via entry_points are not bundled. You may work around this by first installing the script, not this will not recognize the required module.

It seams as if there is time for some more contributions to pyinstaller.

Portrait von Hartmut Goebel
Hartmut Goebel
Diplom-Informatiker, CISSP, CSSLP, ISO 27001 Lead Implementer

Haben Sie noch Fragen?
Anruf oder Mail genügt:
Telefon:   +49 871 6606-318
Mobil:   +49 175 29 78 072
E-Mail:   h.goebel@goebel-consult.de