Hacker News new | ask | show | jobs
by galleywest200 1150 days ago
I thought we were supposed to be using `#!/usr/bin/env python3` and not `#!/bin/python3`?
3 comments

There are two commands that do work in shebang: /bin/sh and /usr/bin/env. Everything else will break sooner or later: BSDs, Nix, Linux distros with separate /bin and /usr/bin and so on.
Correct. What OP uses would run on none of the systems I work with as far as I know
Defintely, `#!/bin/python3` will not work inside venvs, I suppose.
Or any distro that doesn't put a python3 executable in /bin. Many current distros symlink /bin to /usr/bin, but not all do, and python3 would usually be in /usr/bin. POSIX only requires /usr/bin/env and /bin/sh to exist, every other path you might use in a shebang can be moved around.