We are trying to make our python script execute itself as a .exe file, without having python installed. Like if we give our program to someone else, they wouldn't need to install python to open it.
It is a text-based game like zork, so we need a gui, like cmd, to run it.
We have tried using py2exe, and pyinstaller, but none of them made any sense, and don't work with 2.7.3 for some reason.
Any help?
-
Also, could you make a python script open cmd, with the path to the file, so that you can run it from there? With python installed of course. I see that as much easier than making an executable anyways. Just trying to look for something else than having to type the whole C:\python27\python.exe game.py shebang.Erik Rasmussen– Erik Rasmussen2012年12月09日 00:56:28 +00:00Commented Dec 9, 2012 at 0:56
-
1Why don't py2exe and pyinstaller make sense?poplitea– poplitea2012年12月09日 00:57:29 +00:00Commented Dec 9, 2012 at 0:57
-
@poplitea When we try installing it, it either: Doesn't find python 2.7, or: doesn't work installing at all.Erik Rasmussen– Erik Rasmussen2012年12月09日 01:20:39 +00:00Commented Dec 9, 2012 at 1:20
-
They both should work with python 2.7. I would suggest sticking with pyinstaller.jdi– jdi2012年12月09日 01:28:15 +00:00Commented Dec 9, 2012 at 1:28
-
@jdi We fixed it with cx_freeze.Erik Rasmussen– Erik Rasmussen2012年12月09日 02:09:34 +00:00Commented Dec 9, 2012 at 2:09
4 Answers 4
Assuming you have pip installed which you should after installing Python inside folder Scripts. Install PyInstaller using pip, type in the command prompt the following.
- pip install pyinstaller
After you install PyInstaller locate where your pyinstaller files are (they should be where your pip files are inside the Scripts folder) and go to the command prompt and type the following.
- c:\python27\Scripts>pyinstaller --onefile c:\yourscript.py
The above command will create a folder called "dist" inside the Scripts folder, this will contain your single executable file "yourscript.exe".
1 Comment
Can always try http://cx-freeze.sourceforge.net, works with all versions of python including 3.3.
5 Comments
Check out this wiki on deploying Python applications:
http://wiki.python.org/moin/deployment
In addition to what's already been mentioned, it has links to Movable Python, Python-Packager, and others.