[英]No module named flask.ext.restful
trying to run a server尝试运行服务器
(dal)➜ Server (master) python mainDAL.py ✭ ✱
Traceback (most recent call last):
File "mainDAL.py", line 4, in <module>
from flask.ext import restful
File "/Users/partuck/.virtualenvs/dal/lib/python2.7/site-packages/flask/exthook.py", line 87, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.restful
my pip include Flask with the latest version.我的 pip 包括最新版本的 Flask。 what I don't understand is what is this what is this restful module.我不明白的是这是什么,这个宁静的模块是什么。
read here http://flask-restful.readthedocs.org/en/latest/api.html#id1 that it exists.在这里阅读http://flask-restful.readthedocs.org/en/latest/api.html#id1它存在。
(dal)➜ Server (master) pip freeze ✭ ✱
Flask==0.10.1
itsdangerous==0.24
Jinja2==2.7.3
MarkupSafe==0.23
mimerender==0.5.4
pbr==0.10.7
pipdeptree==0.4.2
pymongo==2.7.2
python-dateutil==2.4.0
python-mimeparse==0.1.4
six==1.9.0
SQLAlchemy==0.9.8
stevedore==1.2.0
virtualenv==12.0.5
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.2
Werkzeug==0.9.6
I just met similar problem, My native language is not english, in that tutorial, it said uses flask restful by from flask.ext import restful
, but it will throw out ModuleNotFoundError: No module named 'flask.ext'
.我刚刚遇到了类似的问题,我的母语不是英语,在那个教程中,它说通过from flask.ext import restful
使用flask from flask.ext import restful
,但它会抛出ModuleNotFoundError: No module named 'flask.ext'
。
Finally in Flask-RESTful: english version Tutorial ,最后在Flask-RESTful:英文版教程,
It shows the correct usage from flask_restful import Resource, Api
.它显示了from flask_restful import Resource, Api
的正确用法。
I encountered the same problem and above code was unable to solve my problem.我遇到了同样的问题,上面的代码无法解决我的问题。 You can directly apply the below code:-您可以直接应用以下代码:-
pip install Flask-API
This will help you install Flask-API and you don't need to individually update/load modules.这将帮助您安装 Flask-API,并且您不需要单独更新/加载模块。
first to install flask-restful api use command:首先安装flask-restful api使用命令:
pip install flask-restful
And import the package flask_restful,such as:并导入包flask_restful,如:
from flask_restful import Resource,reqparse, Api
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.