10

Possible Duplicate:
Distributing Python programs

I have several source codes for some GUI programs I made in Python. I'd like to distribute them. However, I'd like to make it as easy as possible for the end user to get the program up and running. What are the common way's of going about this problem?

This is in reference to Windows XP and on.

Community
  • 1
  • 1
rectangletangle
  • 50,393
  • 94
  • 205
  • 275

2 Answers2

22

All noteworthy linux distributions and Mac OS come shipped with some version of Python. Windows don't have Python installed by default, so you must install it separately in order to run a Python module. Of course the installed Python version must be the same as your program (version 2 or 3).

The easiest way to distribute your program is to just distribute the source code (e.g. send your module by email or upload it somewhere) but in that case, the target PC must have Python installed and meet the dependencies. An even better solution (at least for the community) is to upload your program as a package on PyPi. More info for that procedure can be found HERE.

In some cases there are reasons that prevent you from using these options. For example you can't install python and/or the dependencies (no root/admin account). If that is the case, you can bundle your module(s) along with everything else that is required to run your program (e.g python*.dll on windows). As far as i know the basic options for this kind of distribution are the following ones:

  1. PyInstaller
  2. briefcase
  3. fbs
  4. PyOxidizer
  5. nuitka --standalone
  6. py2app (only for Mac OS)
  7. cx_Freeze
  8. freeze
  9. py2exe

  10. cython --embed

Another approach would be to use Portable Python or in case of Linux/BSD StaticPython

Note : Not all of the aforementioned tools run on all platforms or/and support Python3. Check their documentation.

Unmaintained ones

  1. bbFreeze
  2. esky (unmaintained)
  3. vendorID
  4. gui2exe
pmav99
  • 1,909
  • 2
  • 20
  • 27
4

You want py2exe, which is an extension of the distutils package.

http://www.py2exe.org/

asthasr
  • 9,125
  • 1
  • 29
  • 43
  • 7
    py2exe is a distutils extention. It's not part of the distutils package, which is in the Python standard library. – Velociraptors Nov 16 '10 at 02:26
  • 2
    Using py2exe will basically package the Python interpretor and python code into an exe with additional libraries (or no additional files if used with the proper flags). You then can use something like Innosetup http://www.jrsoftware.org/isinfo.php to package the necessary files into a single 'self installer' that will make it easier to distribute to non-techies – g19fanatic Nov 16 '10 at 04:21
  • [here's a commented version](http://aegis.codepad.org/DnSzcjW6) of the py2exe setup script I've used in a couple of projects - it makes a single exe file and has a couple of nice options. also [check out upx](http://upx.sourceforge.net/) to compress the resulting executable – lunixbochs Mar 20 '11 at 22:15