usr/bin/env: bad interpreter Permission Denied --> how to change the fstab
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 woul开发者_Python百科d really appreciate it if someone could help me out with a suggestion!
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
You script should start with:
#! /usr/bin/env whateverelse ...
^ this first one is important
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".
I would recommend you to 'run cygwin as administrator' Thanks. EDIT:- try chmod for permissions read for more here
You should write your command as 'python ./example.py ',then fix it in your script.
This was in Git Bash for me. I changed the first line (shebang line) of the .py file being run, leaving the original, adding the one above it, and that worked:
#!python
#!C:\Users\Emiri\Anaconda\envs\_build\python.exe
("Emiri" doesn't exist on my system, was hardcoded in a zipline install)
In my case I used cmder and started bash as Admin instead of WSL
You can disable SELinux
by using:
setEnforce 0
More info about how to use SELinux
精彩评论