How should the shebang for a Python script look like?
Some people support #!/usr/bin/env python
because it can find the Python interpreter intelligently. Ot
I use #!/usr/bin/env python
as the default install location on OS-X is NOT /usr/bin
. This also applies to users who like to customize their environment -- /usr/local/bin
is another common place where you might find a python distribution.
That said, it really doesn't matter too much. You can always test the script with whatever python version you want: /usr/bin/strange/path/python myscript.py
. Also, when you install a script via setuptools, the shebang seems to get replaced by the sys.executable
which installed that script -- I don't know about pip
, but I would assume it behaves similarly.