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

Ben Finney bignose+hates-spam at benfinney.id.au
Fri May 2 01:48:48 EDT 2008


Jeroen Ruigrok van der Werven <asmodai at in-nomine.org> writes:

> -On [20080502 05:26], Ben Finney (bignose+hates-spam at benfinney.id.au) wrote:
> >I've never clearly understood why people want to use "#!
> >/usr/bin/env python", which is prone to finding a different Python
> >from the one installed by the operating system. I'd be interested
> >to see what responses are in favour of it, and what the reasoning
> >is.
> 
> Simple, some systems are not as peculiar as a lot of Linux boxes
> which chug everything into /usr/bin, which is OS territory (as has
> been decreed long ago by hier(7)), but rather use /usr/local/bin
> (all BSD Unix and derivatives) or /opt or whatever convention a
> particular operating system has.

To my mind, the Python interpreter installed by a package as
distributed with the OS *is* OS territory and belongs in /usr/bin/.

> As such, your script with #!/usr/bin/python is as bad as an ash
> shell script with #!/bin/bash.

Clearly if the program is written to be interpreted by the Ash shell,
it should not declare Bash as the interpreter.

I don't see how declaring Python as the interpreter for a Python
program is supposed to be "as bad" as that.

-- 
 \     "Don't be afraid of missing opportunities. Behind every failure |
  `\      is an opportunity somebody wishes they had missed."  -- Jane |
_o__)                                          Wagner, via Lily Tomlin |
Ben Finney



More information about the Python-list mailing list