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.
 
-- 
Senthil


The price of seeking to force our beliefs on others is that someday they might 
force their beliefs on us. -- Mario Cuomo 
 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Duncan
Sent: Thursday, June 14, 2007 19:44
To: tutor@python.org
Subject: Re: [Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"




On 6/14/07, Ezra Taylor <[EMAIL PROTECTED]> wrote: 

        I think Emilia means what's the difference.  From what little I know, 
#!/usr/bin/env python will choose the first python that's in your path.  Were 
as the second option, you explicitly choose which instance of python you want.  
I'm using using python from Activestate.  So my shebang is to the Activestate 
directory for python.  If I'm wrong, please correct. 
        
        Ezra 
        
        
        
        On 6/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: 

                hi list,
                
                how to choose between "#!/usr/bin/env python" and
                "#!/usr/local/bin/python" in the beginning of the script ? 
                e.
                
                
                
                -----------------------------
                
                SCENA - Ĺäčíńňâĺíîňî ÁĹÇĎËŔŇÍÎ ńďčńŕíčĺ çŕ ěîáčëíč ęîěóíčęŕöčč 
č ňĺőíîëîăčč.
                http://www.bgscena.com/
                
                _______________________________________________ 
                Tutor maillist  -  Tutor@python.org
                http://mail.python.org/mailman/listinfo/tutor
                




        -- 
        Ezra Taylor 
        _______________________________________________
        Tutor maillist  -  Tutor@python.org
        http://mail.python.org/mailman/listinfo/tutor
        
        


The real difference here is that by using the "env"  command, you have the 
option to input many different settings preferences before calling the python 
of your choice.  The statement above, is a very simple choice of the python 
based upon the current environment, but it could be augmented very easily. 

I suggest that you check out the man page for the command "env".  

-- 
David Duncan

Registered Linux User #279425
http://counter.li.org 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to