How can I distribute python programs?

I think it’s also worth mentioning PEX (considering more the attention this question received and less the question itself). According to its own description:

PEX files are self-contained executable Python virtual environments. More specifically, they are carefully constructed zip files with a #!/usr/bin/env python and special __main__.py that allows you to interact with the PEX runtime. For more information about zip applications, see PEP 441.

I stumbled upon it when I read an overview of packaging for python. They posted this nice picture there: enter image description here

To summarize: If you can afford relying on python being installed on the target machine, use PEX to produce a self-containing »executable« which probably will have smaller file size than an executable produced by PyInstaller, for example.


I highly recommend Pyinstaller, which supports all major platforms pretty seamlessly. Like py2exe and py2app, it produces a standard executable on Windows and an app bundle on OS X, but has the benefit of also doing a fantastic job of auto-resolving common dependencies and including them without extra configuration tweaks.

Also note that if you're deploying Python 2.6 to Windows, you should apply this patch to Pyinstaller trunk.

You indicated that you don't need an installer, but Inno Setup is an easy to use and quick to setup choice for the Windows platform.


The normal way of distributing Python applications is with distutils. It's made both for distributing library type python modules, and python applications, although I don't know how it works on Windows. You would on Windows have to install Python separately if you use distutils, in any case.

I'd probably recommend that you distribute it with disutils for Linux, and Py2exe or something similar for Windows. For OS X I don't know. If it's an end user application you would probably want an disk image type of thing, I don't know how to do that. But read this post for more information on the user experience of it. For an application made for programmers you are probably OK with a distutils type install on OS X too.

Tags:

Python