#!/usr/bin/env python vs. #!/usr/bin/python

D'Arcy J.M. Cain darcy at druid.net
Fri May 2 00:44:16 EDT 2008


On Fri, 02 May 2008 13:24:01 +1000
Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
> I much prefer "#! /usr/bin/python" because I want my Python programs
> to, by default, be run with the default Python, and depend on Python
> being installed by the operating system's package manager. On systems
> that use shebang lines and that actually have standardised filesystem
> locations, the default Python is found at '/usr/bin/python'.

You have lived a sheltered life.  Not every packaging system puts the
executible in /usr/bin.  Many systems use /usr/local/bin.  NetBSD
uses /usr/pkg/bin but allows you to define your own pkg root.
Using /usr/bin/env allows your code to run on all these systems.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list