bjskistad bjskistad - 1 year ago 130
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
on it in the terminal, but when I ran
I got an error saying:

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

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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download