Python ModuleNotFoundError: No module named 'returndata'

Python ModuleNotFoundError: No module named 'returndata'

我在 Python 中创建了一个模型,以根据图像预测结果,当 运行 它出现以下错误时:

出现以下错误:

(base) MacBook-Air:Backend desktop$ python main.py
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from returndata import Content
ModuleNotFoundError: No module named 'returndata'

我找不到任何相关内容。 这是我的模型的代码: app.py:

import os
from flask import *
from returndata import Content
import predict as pred
from werkzeug.utils import secure_filename

UPLOAD_FOLDER = './static/UPLOADFOLDER'

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'bmp'])



TOPIC_DICT = Content()
app = Flask(__name__)
app._static_folder = "static"
@app.route('/')
def homepage():
    return render_template("index.html")


@app.route('/skin/')
def skin():
    return render_template("skinLesion.html")

@app.route('/retinopathy/')
def retinopathy():
    return render_template("retinopathy.html")


@app.route('/upload/', methods=["POST"])
def upload():
    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return pred.classify(filename, response=True)

@app.route('/uploadPC/', methods=["POST"])
def uploadPC():
    print("in upload")
    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            category, confidence = pred.classify(filename, response=False)
            print(category, confidence)
            confidence = '%.2f'%(confidence*100)
            if category == "malignant":
                return render_template("malignant.html", confidence=confidence)
            else:
                return render_template("benign.html", confidence=confidence)




@app.route('/uploadDiabetic/', methods=["POST"])
def uploadDiabetic():

    app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
    if request.method == 'POST':
        # check if the post request has the file part
        if 'file' not in request.files:
            print(request.files)
            d = Response("Error",status=201,mimetype='application/json')
            return d
        file = request.files['file']
        # if user does not select file, browser also
        # submit a empty part without filename
        if file.filename == '':
            d = Response("No filename",status=201,mimetype='application/json')
            return d
        if file:
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return pred.classify_retino(filename, response=True)

我不知道如何解决这个问题。有人能帮我吗?非常感谢。

你要我改什么?

你真的在使用 "returndata" 和 "TOPIC_DICT = Content()" 吗?

Python 无法导入此模块。安装它或提供从中导入模块的正确路径。