bjskistad bjskistad - 7 months ago 21
Python Question

Bad Interpreter?

I created an executable Python script (which is a language parser for this), it included this shebang:

#!/usr/bin/env python
and I used the
chmod +x jel.py
on it in the terminal, but when I ran
./jel.py
I got an error saying:

bash: ./jel.py: /bin/env: bad interpreter: No such file or directory


Also, would anyone know how to give the script an alias?

Answer

The symptom you describe is inconsistent with your shebang line:

/bin/env: bad interpreter suggests that the actual shebang line started with #!/bin/env rather than #!/usr/bin/env.

#!/usr/bin/env python actually is a valid shebang line, especially if you don't want to assume a fixed path to the python executable, but want to use one found anywhere (first) in the $PATH.

Comments