Executing python scripts

Alex Martelli aleaxit at yahoo.com
Fri Oct 22 03:26:29 EDT 2004


Shufen <s4046441 at student.uq.edu.au> wrote:

> Hi,
> 
> Can someone please advice me on the differences between this:
> #!/usr/bin/env python and these: #!/usr/local/bin/python or
> #!/usr/bin/python?
> 
> I know the first one locates the Python interpreter according to my
> system searching path setting. But I read about an article that

Right.  The other two hardwire the location.  The first will not work on
an installation which only has Python in /usr/bin, and viceversa.

> mentioned that if we are running the scripts as a CGI from a Web
> server then we should use the latter one. Because I'm using python
> scripts as a CGI now and I'm currently using #!/usr/bin/env python
> this and it seems fine to me, so I would like to know if there is any
> difference.

As long as you control your PATH, and what gets installed where in
directories along your PATH, you should be fine.


Alex



More information about the Python-list mailing list