Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because the whole point is portability, so hardcoding /bin/env when the rest of the world is using /usr/bin/env makes it nonportable!


I'm still confused should I use: #!/usr/bin/env python #!/usr/bin/python

And why?


You should use:

    #!/usr/bin/env python
or preferably

    #!/usr/bin/env python2
or

    #!/usr/bin/env python3
env supposed to always be in /usr/bin, while python doesn't. On FreeBSD for example it is in /usr/local/bin because it is not integral part of the OS.


IIRC not all distros will put executable binaries in /usr/bin/, but even those that don't will usually provide /usr/bin/env (even as a symlink), which will then search your path for python. In summary: /usr/bin/env is more portable. I'm unsure whether "#!/usr/bin/env python" is equivalent to #!python.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: