Python Forum

Full Version: Create .exe with program.py
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good morning all,

I want to create an .exe file with my Python program, so I can use it anywhere.

I installed pyinstaller, started the command on my program.py, several files were created (dist, build, etc). Everything goes well.

However, when I run the .exe file "dist", I do not have time to see the result of my program that it closes live. Maybe it is necessary to add a command line in my program so that it is put in "pause"?

In C, I remember that this command was more or less like this:

Quote:system ( "pause")
Maybe you are looking for this: time.sleep()
there are two possibilities - either your program finishes too fast or there is problem and your exe actually crashes.

to see if it is the former - don't run it by double-click with mouse, but open cmd, change current working directory to one where your exe is and run it from command prompt. This way it will not close the cmd when the execution ends
in this case you can add
input('Press any key...')
at the end and it will wait to press a key before execution ends.