Flask PermissionError:[Errno 13]权限被拒绝 [英] Flask PermissionError: [Errno 13] Permission denied

查看:151
本文介绍了Flask PermissionError:[Errno 13]权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用/opt/mount1/python35/bin/python3.5 notification.py 运行Flask应用程序,但出现以下错误:

I am trying to run a Flask application using /opt/mount1/python35/bin/python3.5 notification.py and I am getting the following error:

WARNING:tensorflow:From /opt/mount1/python35/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
 * Serving Flask app "notification" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File "notification.py", line 19, in <module>
    app.run(debug=True)
  File "/opt/mount1/python35/lib/python3.5/site-packages/flask/app.py", line 943, in run
    run_simple(host, port, self, **options)
  File "/opt/mount1/python35/lib/python3.5/site-packages/werkzeug/serving.py", line 988, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File "/opt/mount1/python35/lib/python3.5/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
    sys.exit(reloader.restart_with_reloader())
  File "/opt/mount1/python35/lib/python3.5/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
    exit_code = subprocess.call(args, env=new_environ, close_fds=False)
  File "/opt/mount1/python35/lib/python3.5/subprocess.py", line 247, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/opt/mount1/python35/lib/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/opt/mount1/python35/lib/python3.5/subprocess.py", line 1289, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

我已对flask应用程序文件夹授予了递归777权限.

I have given recursive 777 permission to the flask application folder.

从上面的堆栈跟踪中,我不确定出了什么问题.

From the above stack trace, I am not sure what is going wrong.

任何帮助将不胜感激.谢谢!

Any help will be appreciated. Thanks!


更新


Updates

我试图使用CentOS 7.6的核心python(即python 2.7 )运行Flask应用,并且有效!

I tried to run the Flask app using the core python of CentOS 7.6 i.e Python 2.7 and it worked!!

我不确定为什么不适用于从其RPM安装到路径/opt/mount1/python35 的python 3.5.6 版本.

I am not sure why it is not working for a python version 3.5.6 which has been installed from its RPM to the path /opt/mount1/python35.

推荐答案

由于我已经在不同的路径中分别安装了Python 3.5,因此必须在文件顶部放置以下 shebang 解决此问题:

Since I had installed the Python 3.5 separately in a different path, I had to place the following shebang at the top of my file to fix the issue:

#!/opt/mount1/python35/bin/python3.5

这篇关于Flask PermissionError:[Errno 13]权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆