2.2.2 Executable Python Scripts

On BSD'ish Unix systems, Python scripts can be made directly executable, like shell scripts, by putting the line

#! /usr/bin/env python

(assuming that the interpreter is on the user's $PATH) at the beginning of the script and giving the file an executable mode. The "#!" must be the first two characters of the file.


guido@python.org