Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a python script executable in python 2.7

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?

like image 872
Erik Rasmussen Avatar asked Nov 13 '22 15:11

Erik Rasmussen


1 Answers

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”.

like image 63
Developer Avatar answered Nov 15 '22 05:11

Developer