proxy_pool Python 3.8需要升级Werkzeug依赖,否则提示type_ignores错误

dl5txlt9  于 5个月前  发布在  Python
关注(0)|答案(2)|浏览(72)

使用Python 3.8, Werkzeug 0.15.3时会提示如下错误:

Traceback (most recent call last):
  File "proxyPool.py", line 19, in <module>
    from api.proxyApi import runFlask
  File "/home/louis/wenshu/proxy_pool/api/proxyApi.py", line 27, in <module>
    app = Flask(__name__)
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 556, in __init__
    self.add_url_rule(
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 64, in wrapper_func
    return f(self, *args, **kwargs)
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/flask/app.py", line 1214, in add_url_rule
    self.url_map.add(rule)
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 1386, in add
    rule.bind(self)
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 730, in bind
    self.compile()
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 794, in compile
    self._build = self._compile_builder(False).__get__(self, None)
  File "/home/louis/wenshu/wenshu/lib/python3.8/site-packages/werkzeug/routing.py", line 945, in _compile_builder
    code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module

经查询,此问题在许多使用Flask的程序中都有,解决方法为升级Werkzeug至 0.15.5 或更高。(我尝试了 pip install Werkzeug==0.16.0 ),成功解决。

可参见:
pjialin/py12306#355
FeeiCN/Cobra#1382
等。

建议修改 requirements.txt 中版本要求。

相关问题