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

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

Ned Deily wrote:
> In article <4aa3bfdf$0$282$14726298 at>,
>  Timothy Madden <terminatorul at> 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):
> osedly-more-correct-than-just-usr-bin-pyth/1352938#1352938
Ok, thank you.
There is quite a flame since May 2008 archived on 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