ModuleNotFoundError: 没有名为“fcntl”的模块

Shu*_*ngh 9 python flask gunicorn server

用于使用 gunicorn 运行的烧瓶应用程序

$ pip install gunicorn
$ gunicorn --bind 0.0.0.0:8000 app:app
Run Code Online (Sandbox Code Playgroud)

出错

回溯(最近一次调用):文件“C:\Users\shubham\AppData\Local\Programs\Python\Python37\lib\runpy.py”,第 193 行,在 _run_module_as_main “ main ”,mod_spec)文件“C:\ Users\shubham\AppData\Local\Programs\Python\Python37\lib\runpy.py”,第 85 行,在run_code exec(code, run_globals) 文件“C:\Users\shubham\Desktop\Full_stack_developer\venv\Scripts\gunicorn .exe_.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 导入 util 文件“c:\users\shubham\desktop\full_stack_developer \venv\lib\site-packages\gunicorn\util.py”,第 9 行,在 import fcntl ModuleNotFoundError: No module named 'fcntl'

Nec*_*don 16

模块 fctnl 在 Windows 系统上不可用

  • 不幸的是,Gunicorn 适用于 UNIX 环境,与 Windows 不兼容。/sf/answers/776144421/ (6认同)
  • 如何在烧瓶应用程序的窗口机器中使用gunicorn,否则我不能 (2认同)

Dav*_*yan 7

它已经在/sf/answers/776144421/(感谢@Necklondon)中提到,但复制到这里,因为它很有用:

pip install waitress
waitress-serve --listen=*:8000 app:app
Run Code Online (Sandbox Code Playgroud)