Is "#!/usr/bin/env python" the better shebang line ?

Timothy Madden terminatorul at gmail.com
Mon Sep 7 02:20:07 CEST 2009


Ned Deily wrote:
> In article <4aa3bfdf$0$282$14726298 at news.sunsite.dk>,
>  Timothy Madden <terminatorul at gmail.com> wrote:
>> My questions is if I should use
>>    #!/usr/bin/env python
>> as the shebang line in a portable and open python script and if it does 
>> help with portability and usage.
> 
> This question came up recently on stackoverflow (alas, will result in 
> urloverflow):
> 
> http://stackoverflow.com/questions/1352922/why-is-usr-bin-env-python-supp
> osedly-more-correct-than-just-usr-bin-pyth/1352938#1352938
> 
Ok, thank you.
There is quite a flame since May 2008 archived on mail.python.org about 
this issue.

#!/usr/bin/env python is clearly the choice for my scripts.

It helps a lot with portability, and the arguments against it are based 
on the idea that /usr/bin/python is somehow better than /opt/python and 
that /opt/python is still in front of /usr/bin/python in path. Such an 
argument I do not find compelling. The thing is that people writing 
large applications for many systems need flexibility first.

Timothy Madden



More information about the Python-list mailing list