[Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"

Alan Gauld alan.gauld at btinternet.com
Fri Jun 15 00:52:32 CEST 2007

>From the welter of posts, coming back to the original,
let's summarise:

<emilia12 at mail.bg> wrote in message 
news:1181816053.e051f8f93c8aa at mail.bg...
> how to choose between "#!/usr/bin/env python" and
> "#!/usr/local/bin/python" in the beginning of the script ?

Use env if you want maximum flexibility across
different machines. It will find where the first python
in the PATH lives and use it.

Use a hard path if you have multiple pythons installed
and it matters which one is used. But be aware that
a hard path may not work on another machine
or OS version.

And neither makes any difference on a non-Unix
based OS. (I count cygwin as being Unix based)


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list