python - ImportError:没有名为 flask_restful 的模块
问题描述
我正在尝试部署 appengine flex python 应用程序,但在部署后在 Stackdriver 日志 stderr 中获得以下内容
File "/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/home/vmagent/app/my_service/entry_point.py", line 5, in <module>
import flask_restful as restful
ImportError: No module named flask_restful
第 5 行的 entry_point.py 有
import flask_restful as restful
我的requirement.txt有
Flask-RESTful==0.3.6
gunicorn==19.7.1
不知道为什么它还在抱怨 Flask-Restful
解决方案
ImportError:没有名为 flask_restful 的模块
似乎您没有安装flask_restful,要安装运行:
pip install flask-restful
在您的终端中,然后运行您的应用程序。
文档:https ://flask-restful.readthedocs.io/en/latest/installation.html
推荐阅读
- python-3.x - 自动化 pdfminer.six LAParams 配置
- html - 我的下拉菜单无法正常工作
- javafx - JavaFX:如何检测 TitledPane 中的渲染结束?
- apache-kafka - Configuring ReplyingKafkaTemplate for getting the responses from multiple topics
- ms-access-2016 - MS Access:如何在按钮单击表单上运行查询?
- json - 如何使用 XSLT 将 JSON 转换为 XML?
- php - 运行时 PHPUnit 的代码覆盖率
- javascript - 填充下拉点击它
- vba - 如何将AutoCAD表格块单元格提取到图像
- python - 找不到命令“python.execInTerminal-icon”