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

Tim Roberts timr at probo.com
Fri May 9 23:03:13 EDT 2008


Brian Vanderburg II <BrianVanderburg2 at aim.com> wrote:
>D'Arcy J.M. Cain wrote:
>> Brian Vanderburg II <BrianVanderburg2 at aim.com> wrote:
>>   
>>> This is sort of related, but I'm wondering what is different between 
>>> "#!/usr/bin/env python" and "#!python".  Wouldn't the second do the same 
>>> thing, since an absolute path is not specified, find 'python' from the 
>>> PATH environment,  I don't really know.
>>
>> Well, I know what happened when I tried it.  What happened when you
>> tried it?
>   
>I haven't tried it but I've seen some files like written that in the 
>past with just a name and no path for some other interpreter (perl or sh 
>probably) and didn't know what the different was or if it was even 
>valid. 

It's not valid.  The shebang line (#!) must specify a full path.  When you
saw the lone word ("perl"), it was probably a /usr/bin/env line, just we
have been discussing.

>I at a windows system now so I can't try it yet.

*IF* you are interested in playing with Linux, most of the distributions
have bootable CDs that will bring up a full Linux environment without ever
touching your hard disk.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list