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

Ben Finney bignose+hates-spam at benfinney.id.au
Fri May 2 10:37:45 EDT 2008


Thorsten Kampe <thorsten at thorstenkampe.de> writes:

> * Ben Finney (Fri, 02 May 2008 23:30:01 +1000)
> > 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.
> > 
> > Others may prefer something different, but then they get to wear
> > whatever problems occur as a result of that choice. I continue to
> > be bemused by that preference, and nothing that I've seen so far
> > in this thread illuminates the issue more.
> 
> You're missing the point. Apart from the really dubious terms you
> use ("OS installable package"), using env in the first line has
> exactly the effect to use the default path of Python (which is the
> first entry in your path)

No, because it's quite common for the PATH variable to have
'/usr/local/bin' appear *before* both of '/bin' and '/usr/bin'.

If the system has a sysadmin-installed '/usr/local/bin/python'
installed as well as the OS-installed '/usr/bin/python', then the two
shebang options the OP raised will behave differently on such a
system. This seems to be quite the point of the discussion.

-- 
 \          "Time's fun when you're having flies."  -- Kermit the Frog |
  `\                                                                   |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list