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

Tim Roberts timr at probo.com
Fri May 2 01:32:28 EDT 2008


Yves Dorfsman <yves at zioup.com> wrote:
>
>On UNIX, some people use
>#!/usr/bin/env python
>
>While other use
>#!/usr/bin/python
>
>Why is one preferred over the other one ?

The /usr/bin/env solution finds the Python interpreter anywhere on the
PATH, whether it be /usr/bin or /usr/local/bin, or whatever.  With
/usr/bin/python, it MUST be in /usr/bin.

Way back when, Python wasn't included in Linux distributions by default, so
it was difficult to predict where it would be.  /usr/bin/env, on the other
hand, is well-established at that location.

These days, since Python is nearly ubiquitous, I suspect it is not so
important.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list