Yves Dorfsman <[EMAIL PROTECTED]> wrote: > On UNIX, some people use > #!/usr/bin/env python > > While other use > #!/usr/bin/python > > Why is one preferred over the other one ? > I don't think the answers so far have communicated what I believe to be the important point: it isn't that one is always better than the other, it depends on what you are trying to achieve.
The first one runs the Python found from the environment. This means you can write a script and expect it to run on systems configured differently. You might prefer in some cases to specify a particular version of Python: #!/usr/bin/env python2.5 The second one runs a specific copy of Python (and here it is even more likely that you'll want to specify a particular version). This is important if your program is being run as a service or some other background situation where the environment isn't set up. For example Subversion hooks all run with an empty environment, and cron jobs run with a default environment which may not include python (e.g. if it is in /usr/local/bin). -- http://mail.python.org/mailman/listinfo/python-list