4
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
 options = {'py2exe': {'bundle_files': 1}},
 windows = [{'script': "single.py"}],
 zipfile = None,
)

in this setup file for py2exe where it says single.py is that where I place the name of my program?

David Dibben
18.9k6 gold badges44 silver badges41 bronze badges
asked Nov 13, 2008 at 7:31
1

3 Answers 3

5

I don't know your py2exe tool, but we usually use this way to convert py to exe:

  1. Download and install Standard Python Software: http://www.python.org/download/

  2. Download PyInstaller via link below: http://pyinstaller.python-hosting.com/

  3. Unpack the archive, that you have downloaded! In this examople, the directory of the unpacked files:

  4. In the <UNPACKED_FILES_DIR> directory, run Configure.py. It must be run before trying to build anything.

  5. Create a spec file for your project:

    python Makespec.py -F -p <PYTHON_LIB_PATH> <PYTHON_SCRIPT>
     -F: Produce a single file deployment.
     -p <PYTHON_LIB_PATH>: Set base path for import (like using PYTHONPATH).
     ( e.g.: C:\Program Files\Python24\Lib\ )
     <PYTHON_SCRIPT>: Path to python script.
    

6 Build your project!

 python Build.py <SPECFILE>
 <SPECFILE>: Path to the specfile, that have been created in step 4! 
 The full path to <SPECFILE>:
 <UNPACKED_FILES_DIR>/<PYTHON_SCRIPT>/<PYTHON_SCRIPT>.spec
  1. The binary file will be placed in the directory of <SPECFILE>.
Greg Hewgill
1.0m192 gold badges1.2k silver badges1.3k bronze badges
answered Nov 13, 2008 at 8:14
Sign up to request clarification or add additional context in comments.

Comments

3

If you can restrict your code, then Shed Skin, PyPy, or Cython make true, fast executables.

Py2exe, PyInstaller, or bbfreeze can package Python up to 2.7 into single executables.

Cx_Freeze packages Python up to 3.x into an executable plus many other files.

answered Nov 2, 2011 at 10:10

Comments

2

Yes. Are you making a windowing application or a console application? See the example setup.py files that came with py2exe.

answered Nov 13, 2008 at 8:10

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.