Why use #!/usr/bin/env python rather than #!python?

Klaus Alexander Seistrup klaus at seistrup.dk
Fri Dec 2 09:02:19 EST 2005


Adriano Ferreira wrote:

> Many Python scripts I see start with the shebang line
>
> #!/usr/bin/env python
>
> What is the difference from using just
>
> #!python

#v+

$ ls -l /tmp/hello.py
-rwxr-xr-x  1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py
$ cat /tmp/hello.py
#! python
print 'Hello, world!'
# eof
$ /tmp/hello.py
bash: /tmp/hello.py: python: bad interpreter: No such file or directory
$ 

#v-

Cheers,

-- 
Klaus Alexander Seistrup
Copenhagen, Denmark
http://streetkids.dk/



More information about the Python-list mailing list