[Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"
Rolando Pereira
finalyugi at sapo.pt
Thu Jun 14 21:07:54 CEST 2007
Senthil_OR at Dell.com escreveu:
> Okay, I guess, people are missing points here.
>
> When do you
>
> #!/usr/local/bin/python
> You are specifying the location to the python executable in your machine, that rest of the script needs to be interpreted with.
> You are pointing to python is located at /usr/local/bin/python
>
> Consider the possiblities that in a different machine, python may be installed at /usr/bin/python or /bin/python in those cases, the above #! will fail.
> For those cases, we get to call the env executable with argument which will determine the arguments path by searching in the $PATH and use it correctly.
>
> Thus,
> #/usr/bin/env python
> Will figure out the correct location of python ( /usr/bin/python or /bin/python from $PATH) and make that as the interpreter for rest of the script.
> - ( env is almost always located in /usr/bin/ so one need not worry what is env is not present at /usr/bin)
>
> Hope this helps.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
I've always used #!/usr/bin/python...
Perhaps I should use the "#!/usr/bin/env python" one.
--
_
ASCII ribbon campaign ( )
- against HTML email X
& vCards / \
More information about the Tutor
mailing list