gpt4 book ai didi

python - 无法从python中的 '_endpoint_from_view_func'导入名称 'flask.helpers'

转载 作者:行者123 更新时间:2023-12-03 16:55:31 26 4
gpt4 key购买 nike

我在Ubuntu上运行相同的代码没有问题,但是在Windows10上运行却有问题。我还安装了Flask。
我的Windows环境配置如下:

$ pip --version
pip 21.1.1 from c:\users\min\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)

$ pip show flask
Name: Flask
Version: 2.0.0
Summary: A simple framework for building complex web applications.
Home-page: https://palletsprojects.com/p/flask
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD-3-Clause
Location: c:\users\min\appdata\local\programs\python\python37\lib\site-packages
Requires: Werkzeug, itsdangerous, Jinja2, click
Required-by: Flask-RESTful, Flask-API

$ pip show flask-restful
Name: Flask-RESTful
Version: 0.3.8
Summary: Simple framework for creating REST APIs
Home-page: https://www.github.com/flask-restful/flask-restful/
Author: Twilio API Team
Author-email: help@twilio.com
License: BSD
Location: c:\users\min\appdata\local\programs\python\python37\lib\site-packages
Requires: Flask, aniso8601, six, pytz
Required-by:
当我运行代码时,输​​入错误
from flask_restful import reqparse, Api, Resource
错误是
Exception has occurred: ImportError
cannot import name '_endpoint_from_view_func' from 'flask.helpers' (C:\Users\Min\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\helpers.py)
File "E:\yulin\python_project\image_text_project_-api\chuanxian_api_module_time_native2.py", line 24, in <module>
from flask_restful import reqparse, Api, Resource
我不知道为什么,请帮助我,非常感谢。

最佳答案

这是一个尚待解决的已知问题here
同时,我建议给猴子打补丁:

import flask.scaffold
flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func
import flask_restful
...

关于python - 无法从python中的 '_endpoint_from_view_func'导入名称 'flask.helpers',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67496857/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com