python 3.9 AttributeError: module 'posix' has no attribute '__all__'

python 3.9 AttributeError: module 'posix' has no attribute '__all__'

我是 运行 flask with uwsgi,而我是 运行,我遇到错误

thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 0.0.0.0:7443 fd 8
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.9.1 (default, Jan 21 2021, 17:26:44)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 46, in _get_exports_list
    return list(module.__all__)
AttributeError: module 'posix' has no attribute '__all__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/export/apps/python/3.9.1/lib/python3.9/site.py", line 73, in <module>
    import os
  File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 69, in <module>
    __all__.extend(_get_exports_list(posix))
  File "/export/apps/python/3.9.1/lib/python3.9/os.py", line 48, in _get_exports_list
    return [n for n in dir(module) if n[0] != '_']
SystemError: <built-in function dir> returned NULL without setting an error

配置文件

[uwsgi]
module = wsgi:app

master = true
processes = 5
protocol = http
socket = 0.0.0.0:7443
die-on-term = true
enable-threads = true
vacuum = true
req-logger = file:/var/log/uwsgi/app/cart-req.log
logger = file:/var/log/uwsgi/app/cart-err.log

缺少任何模块,同样的事情在 python 3.7 中有效,但在 3.9 中无效

uwsgi 还不支持 Python 3.9。

参见 https://github.com/unbit/uwsgi/blob/master/setup.py

中的 trove 分类器

你应该在他们的问题跟踪器上创建一个问题 https://github.com/unbit/uwsgi/issues

更新

正如评论中提到的“root-11”,uwsgi同时支持Python 3.9。此外,我的 link 从 links 到“master”,而不是从创建此答案时到当前版本。这可能令人困惑。