I am sorry if it is simple or repetitive but I have problem with this.
I make a play :
I have python 2.6 or 3.0
a program in my c partition
its name is test.py
I want to compile it and it have to works in linux and windows.
I cannot read english so well please write little sentences with clear means.
Thanks.

Recommended Answers

All 12 Replies

The py2exe module does not compile to an executable.

It packages your Python bytecode files, other needed files and the Python interpeter to run from an executable file.

At this point py2exe is not yet out for Python3.

You will have to make separate executables for Windows and Linux too.

How do you render your projects tocustomers?
You will say himto instal python?
how I do it.Is it possible to make an exe file?if yes how?

py2exe can make .exe files for Windows. These .exe files can run without Python installed. However, .exe files will not run on Linux.

I wrote my condition please write how can i do it.

Well here is the py2exe website:
http://www.py2exe.org/
And here is their tutorial that you should follow:
http://www.py2exe.org/index.cgi/Tutorial

This only makes executables which run on Windows. However, most Linux distributions already come with Python installed, so Python .py files should run fine from them as-is.

#!/usr/bin/env python

from distutils.core import setup
import py2exe
import sys

sys.argv.append("py2exe")

sys.argv.append("--bundle")
sys.argv.append("1")


opt = {"py2exe": {"compressed": 1,
                  "optimize": 2,
                  "ascii": 1,
                  "bundle_files": 1,
                  "packages": ["encodings"]}}

setup(options = opt, zipfile=None, console = [{"script": 'test.py'}])

Um... what exactly are you trying to say with the above post? So you posted some code. Good work, but what is your question/motive?

I have this but realy confused Ihas error.
left it down.say me a way to make an executable program with maprogram
name:test.py
location c:\
how do it?

Well, I posted the tutorial which explains it well. Regardless, put this in a file called setup.py in the same location as your script. Put this in setup.py:

from distutils.core import setup
import py2exe

setup(console=["YOURSCRIPTNAME.py"])  # replace with your program's filename

Then, open the DOS/MS-Windows command prompt, and move to your script's location. Then use this command:

python setup.py py2exe

That should make your .exe. If you have an error, please type out what it says so I can understand what went wrong!

And I just found this:
http://www.pyinstaller.org/

It claims to make executables for Windows, Linux, and Mac. I have never used it myself though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.