On *NIX systems, putting #!/usr/bin/env python as the first line of a program allows the program to be executable by referencing the location of Python on the user's PATH. Of course, this assumes Python is on the PATH; if not, then the program will have to be invoked like normal.
After this has been added to the program, the file itself needs to be modified to make it executable, that is, $ chmod +x <program>.py.
If you are using a terminal program that displays files and directories in different colors depending on their modes, running the command ls on the directory where the file is located should show it with a different color than non-executable files.
To execute the program, simply type ./<program>.py and the program ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.