ModuleNotFoundError: No module named ‘fcntl‘

问题

windows下使用gunicorn,运行Flask项目,报错

$ gunicorn --bind 127.0.0.1:8000 domain_admin.main:app

ModuleNotFoundError: No module named 'fcntl'

原因

看下官网的介绍:

Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX.

可以看到,它仅支持UNIX, 不支持windows

解决

我们可以使用waitress来替换Gunicorn

Waitress - A WSGI server for Python 2 and 3

文档

$ pip install waitress

$ waitress-serve --listen=127.0.0.1:8000 domain_admin.main:app

这样就可以正常启动了

参考
https://stackoverflow.com/questions/45228395/error-no-module-named-fcntl

猜你喜欢

转载自blog.csdn.net/mouday/article/details/127475453