Suppose you don’t know if your Windows users have Python installed — or you don’t know which version of Python they’ve got installed. You can still distribute a Python program to them using py2exe.

Here’s how:

  • Make sure that you yourself have Python installed, and that you know which version you have installed (python -v will tell you).
  • Visit to get an overview of what Py2exe does.
  • Head over to the SourceForge and download the version of Py2exe which matches your version of Python
  • Install Py2exe
  • Look though the code samples to find something which matches what you need to do
  • And do it!

Using Py2exe

Suppose you want to distibute my solution to the 8 Queens puzzle. You need to create a file called which looks like:

from distutils.core import setup
import py2exe
setup (
  version = "1.0",
  name = "N Queens puzzle solver",
  console = [""]

Then run:

python py2exe

The executable and DLLs appear in the dist subdirectory of your current working directory.