In article <34va6856ocuas7jpueujscf3kdt7k44...@4ax.com>,
 Gilles <nos...@nospam.com> wrote:

> Hello
> 
> I've seen both shebang lines to run a Python script on a *nix host:
> 
> #!/usr/bin/env python
> #!/usr/bin/python
> 
> What's the difference?

The first one looks through your PATH to find the right python 
interpreter to run.  The second one is hard-wired to run /usr/bin/python.

If you only have a single copy of python installed, it doesn't really 
matter which you use.  But, you might as well get into the habit of 
using the /usr/bin/env flavor because it's more flexible.

I'm working on a number of different python projects.  For each one, I 
set up a new virtual environment using virtualenv.  This lets me run 
different versions of python in different projects, with different 
collections of installed packages (and possibly different versions).  I 
can only do this because I use the /usr/bin/env line in all my scripts.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to