usr/bin/env: bad interpreter Permission Denied --> how to change the fstab
Solution 1
In my case the problem was in the missing executable flag on the file.
The solution for me was in the following code
chmod +x ./executed_file
Solution 2
You script should start with:
#! /usr/bin/env whateverelse ...
^ this first one is important
Solution 3
This seems to be a late answer, but may be useful for others. I got the same kinda error, when I was trying to run a shell script which used python. Please check \usr\bin for existence of python. If not found, install that to solve the issue. I come to such a conclusion, as the error shows "bad interpreter".
Hatmaker
Updated on August 11, 2021Comments
-
Hatmaker over 2 years
I'm using cygwin on windows 7 to run a bash script that activates a python script, and I am getting the following error:
myscript.script: /cydrive/c/users/mydrive/folder/myscript.py: usr/bin/env: bad interpreter: Permission Denied.
I'm a total newbie to programming, so I've looked around a bit, and I think this means Python is mounted on a different directory that I don't have access to. However, based on what I found, I have tried to following things:
- Change something (from user to exec) in the fstab: however, my fstab file is all commented out and only mentions what the defaults are. I don't know how I can change the defaults. The fstab.d folder is empty.
- change the #! usr/bin/env python line in the script to the actual location of Python: did not work, same error
- add a PYTHONPATH to the environment variables of windows: same error.
I would really appreciate it if someone could help me out with a suggestion!
-
Chris Wesseling over 12 yearsYou mean
#!/usr/bin/env python
, that space is important too. -
Chris Wesseling over 12 years
Blanks after ! are OK.
-- Dennis Ritchie . I had other experience, but that must have been an error in the implementation... You're right. Upvoted; I learned something :-) -
Mat over 12 yearsYeah, it doesn't really matter. I just find it prettier with a space :)
-
Hatmaker over 12 yearsHm, so I tried changing that and it didn't work. I get the same error (although now it's /usr/bin/env etc...)
-
Mat over 12 yearsWell, does
/usr/bin/env
exist? Is it executable? Can you run it from the command line? -
Keith Thompson about 9 years