zoukankan      html  css  js  c++  java
  • Flask CLI抛出'OSError:[Errno 8] Exec格式错误'

    这个是报错 运行的时候出现的

    /home/python/.virtualenvs/flask_dome/bin/python3.6 /home/python/Desktop/flask_demo_01/app.py
     * Serving Flask app "app" (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://192.168.0.140:8888/ (Press CTRL+C to quit)
     * Restarting with stat
    Traceback (most recent call last):
      File "/home/python/Desktop/flask_demo_01/app.py", line 79, in <module>
        app.run(host='192.168.0.140',port=8888)
      File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/flask/app.py", line 943, in run
        run_simple(host, port, self, **options)
      File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/serving.py", line 988, in run_simple
        run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
      File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
        sys.exit(reloader.restart_with_reloader())
      File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
        exit_code = subprocess.call(args, env=new_environ, close_fds=False)
      File "/usr/lib/python3.6/subprocess.py", line 267, in call
        with Popen(*popenargs, **kwargs) as p:
      File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    OSError: [Errno 8] Exec format error: '/home/python/Desktop/flask_demo_01/app.py'

    原因及解决办法:

    https://stackoverflow.com/questions/55271912/flask-cli-throws-oserror-errno-8-exec-format-error-when-run-through-docker

    [GitHub]:pallets / werkzeug - 0.15.0导致OSError:[Errno 8] Exec格式错误:在Docker for Windows

    这是Werkzeug 0.15中的一种新行为。降级到Werkzeug 0.14.1。

    卸载 

    (flask_dome) python@ubuntu:~/Desktop/house_bjweb$ pip install Werkzeug
    Requirement already satisfied: Werkzeug in /home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages (0.15.0)

    安装

    (flask_dome) python@ubuntu:~/Desktop/house_bjweb$ pip install Werkzeug==0.14.1
    Collecting Werkzeug==0.14.1
      Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
         |████████████████████████████████| 327kB 12kB/s 
    Installing collected packages: Werkzeug
      Found existing installation: Werkzeug 0.15.0
        Uninstalling Werkzeug-0.15.0:
          Successfully uninstalled Werkzeug-0.15.0
    Successfully installed Werkzeug-0.14.1

    运行成功:

    /home/python/.virtualenvs/flask_dome/bin/python3.6 /home/python/Desktop/flask_demo_01/app.py
     * Serving Flask app "app" (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://192.168.0.140:8888/ (Press CTRL+C to quit)
     * Restarting with stat
     * Debugger is active!
     * Debugger PIN: 264-574-474
  • 相关阅读:
    配置高并发jdbc连接池
    java中的sleep()和wait()的区别
    程序员必知的8大排序(三)-------冒泡排序,快速排序(java实现)
    转HashMap Hashtable区别
    chrome 常用快捷操作
    sublime Text 常用操作
    flash 右键菜单隐藏与修改
    As3.0 视频缓冲、下载总结
    flash cs6 更新到Flash player15.0 及Air 更新方法
    As3.0 Interface 与类的使用
  • 原文地址:https://www.cnblogs.com/Xingtxx/p/11097331.html
Copyright © 2011-2022 走看看