3 ms·
Why is this a bad idea?
by JupiterMoon 11y ago
Why is this a bad idea?
- rleigh 11y agoBecause the whole point is portability, so hardcoding /bin/env when the rest of the world is using /usr/bin/env makes it nonportable!
- JupiterMoon 11y agoI'm still confused should I use: #!/usr/bin/env python #!/usr/bin/python And why?
- mkingston 11y agoIIRC 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.
- takeda 11y agoYou 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.