-bash: ./manage.py: 权限被拒绝
运行后: $ ./manage.py migrate
我收到以下错误:
-bash: ./manage.py: Permission denied
在数据库中进行更改后尝试运行迁移。 任何建议将不胜感激。
After running:$ ./manage.py migrate
I am getting the following error:
-bash: ./manage.py: Permission denied
Trying to run a migration after making a change in the DB.
Any advice would be really appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您需要使manage.py可执行才能执行它。执行
chmod +x manage.py
使其可执行。或者,您也可以执行python manage.py
。You need to make manage.py executable to excecute it. Do
chmod +x manage.py
to make it excecutable. Alternately you can dopython manage.py <cmd>
instead.要授予自己对包含脚本的文件的执行权限,请使用以下命令:
要授予其他用户读取和执行但不更改 shell 脚本的权限,请使用:
参考 http://unixhelp.ed.ac.uk/scrpt/scrpt1.2.html
To give yourself execute permission for the file containing the script use the command:
To give other users permission to read and execute but not alter the shell script use:
reference http://unixhelp.ed.ac.uk/scrpt/scrpt1.2.html
您可以尝试使用
而不是 .
You can try to use
instead of .
在 python 代码的顶部添加这一行;
#!/usr/bin/python3
然后通过写入 chmod +x使文件可执行在终端上
然后重试
Add this line at the top of your python code;
#!/usr/bin/python3
Then make your file executable by writing chmod +x <file.py> on terminal
then try again
我在 root 之后输入了
su root space
并且它起作用了。root
是我的管理员密码,然后是 CMD,管理员密码后面有一个空格。I typed
su root space
after root and it worked.root
was my admin password then the CMD after with a space after the admin password.