1

We have a Py module we'd like to give to users in the form of a windows executable. Is there a good tried and true tool to package a py module to Windows exe?

6
  • @mgilson you should make that an answer rather than a comment. Commented Jul 23, 2012 at 13:16
  • 3
    Note that there aren't solutions that will compile Python in to opaque byte or machine code, really, only tools that will give you the ability to distribute a 1-click-runnable Python program. Commented Jul 23, 2012 at 13:16
  • @mgilson we did, but it currently depends on/built for py2.6 our dev environment is set for py 2.7 Commented Jul 23, 2012 at 13:20
  • @sr2222 that's exactly what we're looking for. Not looking for a compiler but rather for a "standalone" executable for machines w/o py. Commented Jul 23, 2012 at 13:21
  • @Duncan -- I didn't feel confident enough to make it an answer as I've never used py2exe myself. I've just seen it referenced a bunch of times. Commented Jul 23, 2012 at 13:23

3 Answers 3

2

As an alternative to py2exe if you're running a 3.x version of Python, you can use cx_freeze (http://cx-freeze.sourceforge.net/). It doesn't package the program into a single executable, but you can package all the files it generates into a self-extracting archive for deployment. See https://stackoverflow.com/a/11511735/369977 for details.

Sign up to request clarification or add additional context in comments.

Comments

1

You can use Python extention py2exe.

In Python you can use the code:

from distutils.core import setup
import py2exe

setup(console=['test.py'])

to make the executable test.exe

8 Comments

Aye, I was few secs to late. I see we Googled the same code :)
I just stole the tutorial directly from their website
likewise here. I don't understand why @Syrahn didn't Google it before asking. It was the first thing that popped up on the serach.
@Gunnar I did Google it before asking. Don't jump to conclusions. Firstly the project seems to have been abandoned since 2008, secondly it's only compatible with Py 2.6
@Syrahn, really? There is a py2exe package for Python 2.7 in SourceForge.
|
0
from distutils.core import setup
import py2exe

setup(console=['hello.py'])

So long as you have py2exe installed it will compile hello.py to an exe, (it actually just bundles the stdlib and interpreter into an executable.)

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.