当我尝试从flask_restx
导入字段时,出现了上述错误。
from flask_restx import fields
出什么问题了。它在我的本地机器上工作,但在远程机器上不工作。
完整错误跟踪:
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask_restx/__init__.py", line 4, in <module>
from . import fields, reqparse, apidoc, inputs, cors
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask_restx/fields.py", line 16, in <module>
from flask import url_for, request
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
from . import json as json
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
from ..globals import current_app
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
File "/root/.clearml/venvs-builds/3.8/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
app_ctx: "AppContext" = LocalProxy( # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'
4条答案
按热度按时间pgpifvop1#
我把 flask==2.1.3 添加到我的要求中,它起作用了。我认为这是flask/当前最新版本的问题
c2e8gylq2#
我的requirements.txt中有一个旧版本的Werkzeug需要删除
tp5buhyn3#
从requirements.txt添加最新版本的flask在这里您可以知道最新的当前版本
https://pypi.org/project/Flask/
Flask==2.2.2这是当前版本,请从上面的链接中确认。
wwodge7n4#
pip安装培养瓶==2.1.3
以下博客详细介绍了所有修复:https://bobbyhadz.com/blog/python-typeerror-init-got-an-unexpected-keyword-argument-unbound-message