Appendix B. Running Programs
If you have a program open in IDLE’s file editor, running it is a simple matter of pressing F5 or selecting the Run▸Run Module menu item. This is an easy way to run programs while writing them, but opening IDLE to run your finished programs can be a burden. There are more convenient ways to execute Python scripts.
The first line of all your Python programs should be a shebang line, which tells your computer that you want Python to execute this program. The shebang line begins with
#!, but the rest depends on your operating system.
On Windows, the shebang line is
On OS X, the shebang line is
#! /usr/bin/env python3.
On Linux, the shebang line is
You will be able to run Python ...