This question already has an answer here:
这个问题已经有了答案:
- -bash: ./manage.py: Permission denied 3 answers
- bash:。/管理。允许被拒绝了3个答案
I downloaded a python script from the web and when i try to execute it from bash it throws a exception:
我从web上下载了一个python脚本,当我尝试从bash执行它时,它会抛出一个异常:
User:python_script user$ ./python_script.py -n some_parameter -b
用户:用户。美元/ python_script python_script。py - n some_parameter - b
The output is the following:
输出如下:
-bash: ./python_script.py: Permission denied
the file all ready has: #!/usr/bin/python
at the top of the script. How can i solve this?
所有准备好的文件都有:#!脚本顶部的/usr/bin/python。我怎么解决这个问题?
1 个解决方案
#1
11
You need to add execute permissions like so:
您需要添加执行权限如下:
chmod u+x python_script.py
This assumes that the script is owned by you. If it isn't, you might need to change the group/other execute permissions or chown
the file as appropriate.
这假定脚本归您所有。如果不是,您可能需要更改组/其他执行权限,或者根据需要修改文件。
#1
11
You need to add execute permissions like so:
您需要添加执行权限如下:
chmod u+x python_script.py
This assumes that the script is owned by you. If it isn't, you might need to change the group/other execute permissions or chown
the file as appropriate.
这假定脚本归您所有。如果不是,您可能需要更改组/其他执行权限,或者根据需要修改文件。