usr/bin/env: bad interpreter Permission Denied --> how to change the fstab

◇◆丶佛笑我妖孽 提交于 2020-02-01 04:23:25

问题


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!


回答1:


You script should start with:

#! /usr/bin/env whateverelse ...
   ^ this first one is important



回答2:


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".




回答3:


You should write your command as 'python ./example.py ',then fix it in your script.




回答4:


I would recommend you to 'run cygwin as administrator' Thanks. EDIT:- try chmod for permissions read for more here




回答5:


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)




回答6:


You can disable SELinux by using:

setEnforce 0

More info about how to use SELinux



来源:https://stackoverflow.com/questions/7716357/usr-bin-env-bad-interpreter-permission-denied-how-to-change-the-fstab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!