Here I just refer the tutual from py2exe official page, that's simple and useful: http://www.py2exe.org/index.cgi/Tutorial
It contains following steps, Here I just comment it when I feel it's necessary:
1. Create/test your program
2. Create your setup script (setup.py)
The setup.py looks like:
1 from distutils.core import setup
2 import py2exe
3
4 setup(console=['hello.py'])
5
Here console means the windows console application, there are also several alternatives:
# New keywords for distutils' setup function specify what to build:
#
# console
# list of scripts to convert into console exes
#
# windows
# list of scripts to convert into gui exes
#
# service
# list of module names containing win32 service classes
#
# com_server
# list of module names containing com server classes
#
# ctypes_com_server
# list of module names containing com server classes
#
# zipfile
# name of shared zipfile to generate, may specify a subdirectory,
# defaults to 'library.zip'
I just use windows when I build the wxpython gui application
3. Run your setup script
python setup.py py2exe
4. Test your executable (Just double-click the exe file in dist directory)
5. Providing the Microsoft Visual C runtime DLL
For Python 2.6, the DLL you need is called MSVCR90.dll, if you haven't installed the VS2008, you should download this dll from web.
Reference:
FAQ: http://www.py2exe.org/index.cgi/FAQ
Working with Various Packages and Modules: http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules