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

Banibrata Dutta banibrata.dutta at gmail.com
Tue May 6 04:35:25 EDT 2008


On 5/6/08, andrej.panjkov at climatechange.qld.gov.au
<andrej.panjkov at climatechange.qld.gov.au> wrote:
> At our site we run  IRIX, UNICOS, Solaris, Tru64, Linux, cygwin and
> other unixy OSes.
>
> We have python installed in a number of different places:
> /bin/python
> /usr/local/bin/python
> /usr/bin/python
> /opt/freeware/Python/Python-2.5.1/bin/python
> ~mataap/platform/python/python-2.5.1
>
> So I cannot assume a single location for python.  Nor for any other
> tool, really.  Bash for example.  It may indeed be in /usr/bin on many
> systems, on many others it is not.
>
> Note the version specific install points.  This allows us to switch
> over easily to different versions, and keep older versions in case
> they are needed.  We can test new versions before cutting over to them
> operationally. (This matters for tools that are still changing, like
> python or bash.)
>
> We use the very handy 'modules' package (not python modules, not
> fortran modules) to adjust our paths and environment variables as
> needed.
>
> Some of the install points are determined by policy, or historical
> constraints, or hardware limits, or file system layout.
>
> Now it is true that it is easy to edit a single script to change the
> hashbang line.  It is not easy to change several hundred scripts, on
> different machines.  It is easy to adjust the environment to point to
> the right python path, and have all your scripts pick it up
> automatically.

Looks reasonable thing to do...

>
> Use /usr/bin/env.  If env is not in /usr/bin, put a link to it there.

So why not put symlink to Python over there on all machines, if we can
put one (or env itself) there ?

-- 
regards,
Banibrata
http://www.linkedin.com/in/bdutta



More information about the Python-list mailing list