Page 1 of 1

Python Questions - py2exe?

Posted: Tue Dec 31, 2013 10:45 pm
by Protheuz
Hellolo!

I'm going to try to make a game, and I got some questions about that.
* py2exe question, is the ''downloader'' forced to download python or the modules that I'm gonna use? (I think PyGame)
* py2exe question, will the .exe work on the RPi? Or is there another similar that will make an ''executable''?(I need py2exe for windows)
* Is there any information that I really should know?

Thanks in advance!

Re: Python Questions - py2exe?

Posted: Wed Jan 01, 2014 9:43 pm
by rickseiden
Without doubt, py2exe will not work for the Raspberry Pi. According to their own website:
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs.
The Raspberry Pi is not a Windows machine, so it can't run Windows executable.

This post on stackoverflow answers the question of how to make python scripts executable in Linux (which is what Raspberry Pi is running).

Re: Python Questions - py2exe?

Posted: Sun Dec 30, 2018 3:28 am
by treii28
OK, py2exe may not be able to create programs that will run on raspberry pi, but there's no reason it couldn't create exe files that would run on a windows machine. It just needs to cross compile to suit the target platform. Now that doesn't mean anyone has ported the code over, but creating an exe and running an exe are two different things.

Re: Python Questions - py2exe?

Posted: Sun Dec 30, 2018 9:56 am
by gkreidl
You could use nuitka which offers a standalone option (nuitka.net)

Re: Python Questions - py2exe?

Posted: Sun Dec 30, 2018 2:12 pm
by MrYsLab
If having your users install your program using Python setup tools or pip is acceptable to you, you can configure setup.py specifying "Entry Points".
This will install the program as a native (Windows, macOS, Linux) executable that will be available on the command line for the user.
Here is a link that helps explain this:
https://chriswarrick.com/blog/2014/09/1 ... d-scripts/

Re: Python Questions - py2exe?

Posted: Sun Dec 30, 2018 2:17 pm
by n67
MrYsLab wrote:
Sun Dec 30, 2018 2:12 pm
If having your users install your program using Python setup tools or pip is acceptable to you, you can configure setup.py specifying "Entry Points".
This will install the program as a native (Windows, macOS, Linux) executable that will be available on the command line for the user.
Here is a link that helps explain this:
https://chriswarrick.com/blog/2014/09/1 ... d-scripts/
The usual reasons for wanting to "compile" scripts are either:

1) Greater efficiency (i.e., a true "compile" should get you execution speeds on par with the equivalent program written in either C or assembler)

2) Encryption - i.e., don't want users to be able to see the source code.

Nowadays, it is almost always the later.

Now, I may be wrong (as I often am about things Python), but I don't think the "Entry Points" method (I read the URL briefly) speaks to either of these points. Am I wrong about that?

Re: Python Questions - py2exe?

Posted: Sun Dec 30, 2018 2:42 pm
by MrYsLab
You are correct. Since the op does not provide a rationale for wanting the .exe, I offer this as a possible solution.
It all depends upon the project's requirements.