You already have complete tutorials shipped with Py2exe that you can use for your application.
The samples are located under Python\Lib\site-packages\py2exe\samples.
As a quick example this is the setup.py I use in my application to create a single executable with all the required libraries embedded, but keep in mind that any data files e.g. picture, sound, textfile etc will need to be bundled with the executable.
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
self.version = "0.0.0"
self.company_name = "Mr.Pyo-Pyo Company"
self.copyright = "o_O"
self.name = "Mr.Puyo-Puyo"
test_wx = Target(
description = "Mr.Puyo-Puyo",
script = "main.py", # Modify this to use your main .py file
dest_base = "Mr.Puyo-Puyo")
setup(
options = {"py2exe": {"compressed": 1,
"optimize": 2,
"ascii": 1,
"bundle_files": 1}},
zipfile = None,
windows = [test_wx],
)
Running the setup script is as simple as running the script inside your applications directory, and it will create the the executable inside a folder called dist.
If you are running into any errors, you probably need to install the Microsoft Visual C++ 2008 Redistributable Package.
everycomputer. If you distribute the actual python files, you can run it on most machines, but will require the user to install python first.Py2exewill only run on Windows, and possibly using Mono under Linux.