【问题标题】:ModuleNotFoundError: No module named 'fcntl' [duplicate]ModuleNotFoundError:没有名为“fcntl”的模块[重复]
【发布时间】:2020-10-28 12:00:11
【问题描述】:

使用 gunicorn 运行烧瓶应用程序

$ pip install gunicorn
$ gunicorn --bind 0.0.0.0:8000 app:app

出现错误

Traceback(最近一次调用最后一次): _run_module_as_main 中的文件“C:\Users\shubham\AppData\Local\Programs\Python\Python37\lib\runpy.py”,第 193 行 "ma​​in", mod_spec) run_code 中的文件“C:\Users\shubham\AppData\Local\Programs\Python\Python37\lib\runpy.py”,第 85 行 执行(代码,run_globals) 文件“C:\Users\shubham\Desktop\Full_stack_developer\venv\Scripts\gunicorn.exe_main.py”,第 5 行,在 文件“c:\users\shubham\desktop\full_stack_developer\venv\lib\site-packages\gunicorn\app\wsgiapp.py”,第 9 行,在 从 gunicorn.app.base 导入应用程序 文件“c:\users\shubham\desktop\full_stack_developer\venv\lib\site-packages\gunicorn\app\base.py”,第 11 行,在 从 gunicorn 导入实用程序 文件“c:\users\shubham\desktop\full_stack_developer\venv\lib\site-packages\gunicorn\util.py”,第 9 行,在 导入 fcntl ModuleNotFoundError: 没有名为“fcntl”的模块

【问题讨论】:

    标签: python flask server gunicorn


    【解决方案1】:

    模块 fctnl 在 Windows 系统上不可用

    【讨论】:

    • 如何在窗口机器中使用 gunicorn 进行烧瓶应用程序,否则我不能
    • 不幸的是,Gunicorn 用于 UNIX 环境,与 Windows 不兼容。 stackoverflow.com/a/11087777/12362709
    【解决方案2】:

    如果您想在 Windows 上运行 gunicorn,可以使用适用于 Windows 的 Ubuntu 终端:https://ubuntu.com/tutorials/ubuntu-on-windows#1-overview

    终端将允许 linux 命令工作。我自己用它来运行 gunicorn。

    【讨论】:

      【解决方案3】:

      它已经在https://stackoverflow.com/a/11087777/12362709 中提到过(感谢@Necklondon),但在这里复制它,因为它很有用:

      pip install waitress
      waitress-serve --listen=*:8000 app:app
      

      【讨论】:

      • 这是女服务员服务
      • 谢谢,已修复。
      猜你喜欢
      • 1970-01-01
      • 2020-12-29
      • 2020-04-12
      • 2020-04-18
      • 2017-05-30
      • 2019-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多