Hacker News new | past | comments | ask | show | jobs | submit login

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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: