Python script executable on Unix

On Unix it works usually in the following way:

As the very first line of your file, using the pathname for where the Python interpreter is installed on your platform.

Put #!/usr/bin/env python in the first line of your .py script.

Add execution permissions to the file (using chmod).

chmod +x < script.py >

Execute the script from command line , eg. by providing ./my_script.py when in the same directory.