On Fri, 28 Sep 2012 06:57:28 -0400 Roy Smith <[email protected]> wrote: > > I've seen both shebang lines to run a Python script on a *nix host: > > > > #!/usr/bin/env python > > #!/usr/bin/python > > > > What's the difference? > > The first one looks through your PATH to find the right python > interpreter to run. The second one is hard-wired to run /usr/bin/python. > > If you only have a single copy of python installed, it doesn't really > matter which you use. But, you might as well get into the habit of > using the /usr/bin/env flavor because it's more flexible.
Not just flexible but portable. On various systems I have Python in /usr/bin, /usr/local/bin and /usr/pkg/bin. "#!/usr/bin/env python" finds it in each case so I only need one version of the script. -- D'Arcy J.M. Cain <[email protected]> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. IM: [email protected] -- http://mail.python.org/mailman/listinfo/python-list
