ModuleNotFoundError:没有名为“ flask_restful”的模块?

时间:2019-09-20 03:03:36

标签: python mysql

我使用VSCODE运行python连接mysql代码,但是得到ModuleNotFoundError:没有名为“ flask_restful”的模块。

没有安装两个模块就不能运行代码: 1.from flask_restful导入资源 2.from flask_restful import reqparse

我该怎么办?谢谢!

from flask_restful import Resource
from flask_restful import reqparse
from flask import jsonify

import json

DB_HOST = "localhost"
DB_USER = "root"
DB_PASSWORD = ""
DB_SCHEMA = "flask_demo"


parser = reqparse.RequestParser()
parser.add_argument("name")
parser.add_argument("gender")
parser.add_argument("birth")
parser.add_argument("note")

2 个答案:

答案 0 :(得分:2)

您需要使用

在您的终端中安装flask_restful
pip install flask_restful

答案 1 :(得分:1)

在运行代码前先安装flsk-restful更多参考https://flask-restful.readthedocs.io/en/latest/installation.html

pip install flask-restful