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

D'Arcy J.M. Cain darcy at druid.net
Fri May 2 10:15:08 EDT 2008


On Fri, 02 May 2008 23:30:01 +1000
Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
> The OP was asking why people prefer on over the other. My answer is
> that I prefer specifying "give me the default OS Python" because
> anything not installed by the OS is to non-standardised for me to
> worry about.

As someone else pointed out, not all the world is Linux.  So your
version of Linux (I'm not sure whether it is true for all versions or
not) delivers Python as part of the OS.  That is simply not true of the
whole world.  Some OS distributions have an adjunct facility for
installing packages but they are not part of the OS.  Some systems
don't even have that and people must download packages such as Python
and install them manually.  Even on Linux there are people who won't
install binaries and use NetBSD's pkgsrc instead.  Clearly that cannot
install into /usr/bin since it is not part of the OS.

Certainly #! /usr/bin/python is fine if you never expect your software
to run outside of your own little corner of the world but you asked why
people prefer the env version and the answer is that we want to write
software that runs everywhere that Python runs.

-- 
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