Python Forum
Make a Python program executable in Windows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make a Python program executable in Windows
The gf now has Python on her Windows 10 laptop. She wants to learn a bit of Python.

To make the file executable in Linux I usually just go to the file, right click, choose Properties, then Permissions, then click the box "Allow executing the file as program" or I can use: chmod +x in bash. (Yesterday I spent about an hour wondering why my new app wouldn't run, until I realized I had forgotten this step!)

Then I can run the program in bash, or lately, I've made some tkinter stuff which starts from an icon on the desktop.

I know nothing about Windows, except that I don't like it.

How should I make a Python program executable in Windows?

I read a bit about pyinstaller. Is this the best way?
Often the python installation will associate the ".py" extension with your python interpreter. So you just need to double-click on it in explorer. If you output text though, beware the window will disappear after the program exits. So if you want to see data you've print()ed at the end, you might end the program with something like:
input("Press enter to end the program")
so the window doesn't go away until you're done looking at the data. Wouldn't be a problem with tkinter where you normally exit explicitly.

You could also just type python <> from a command window.

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make a Vocal synthesizer program on Python? Seadust 3 764 Jan-28-2021, 06:26 PM
Last Post: gonnach
  How to really use this youtube-upload program in Windows? Jacksonsteel 1 374 Dec-18-2020, 07:38 PM
Last Post: snippsat
  Python 3.7, Windows 10, pyinstaller, winsound, no sound in executable kmarien 3 676 Nov-30-2020, 04:10 PM
Last Post: buran
  How to make a Python program run in a dos shell (cmd) Pedroski55 2 562 Nov-09-2020, 10:17 AM
Last Post: DeaD_EyE
  I try to make Heron formula program abcd 7 732 Oct-22-2020, 12:48 AM
Last Post: abcd
  Executable looks like virus to windows samuelbachorik 4 1,091 Apr-27-2020, 02:46 PM
Last Post: samuelbachorik
  I code a program to solve puzzle but i can't make it more dynamic. Shahmadhur13 5 1,027 Apr-18-2020, 10:05 AM
Last Post: Shahmadhur13
  How to keep a loop containing a web import working in python executable? coder1384 3 1,094 Feb-22-2020, 06:49 PM
Last Post: snippsat
  Program not executable after installation mpmackenna 0 481 Feb-10-2020, 09:45 PM
Last Post: mpmackenna
  Error while trying to see Python version with "sys.executable" karkas 5 1,864 Feb-09-2020, 01:55 AM
Last Post: karkas

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020