Python py2exe
From wikinotes
- install python2.7 (non-portable)
- install py2exe (non-portable)
- write your python script (myscript.py)
- write an installer script:
Compile Code only (no external dependencies)
#!/usr/bin/python2 #------------------- # # Build binary with the source code and this script in the same directory and then: # python2 setup.py py2exe from distutils.core import setup import py2exe, sys setup(console=['myscript.py'])
Compile With Dependencies (x86 only)
#!/usr/bin/python2 #------------------- # # Build binary with the source code and this script in the same directory and then: # python2 setup.py py2exe from distutils.core import setup import py2exe, sys setup( options = {'py2exe': {'bundle_files': 1, 'compressed': True}}, console = [{'script': 'myscript.py'}], zipfile = None, )
- rewrite your path environment variable (maybe it gets confused with multiple installations?)
- PATH;"C:/python27";
- navigate to your folder (any folder) with both setup.py and myscript.py in cmd
- python setup.py py2exe
- A new folder called dist will be created with your executable.
ref: http://www.kosbie.net/cmu/fall-10/15-110/koz/notes-py2exe-tutorial.html