0
ImportError: DLL load failed: The specified module could not be found.

C:\Users\hp\.spyder-py3>python app.py
Traceback (most recent call last):
  File "app.py", line 13, in <module>
    model = pickle.load(open('model.pkl', 'rb'))
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\__init__.py", line 82, in <module>
    from .base import clone
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\__init__.py", line 28, in <module>
    from .fixes import np_version, parse_version
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\fixes.py", line 20, in <module>
    import scipy.stats
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\__init__.py", line 384, in <module>
    from .stats import *
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\stats.py", line 179, in <module>
    from scipy.spatial.distance import cdist
  File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\__init__.py", line 99, in <module>
    from .qhull import *
          ImportError: DLL load failed: The specified module could not be found.

如何解决此错误?我正在创建一个项目并使用 flask 部署模型。但是在线上model=pickle.load("fl","rb"))我遇到了错误。

import numpy as np

from flask import Flask, request, jsonify, render_template

import pickle

app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))

@app.route('/')
def home():
    return render_template('index.html')

@app.route('/predict',methods=['POST'])

def predict():
   
    features = request.form.values()
    prediction = model.predict(features)

    output = prediction

    return render_template('index.html', prediction_text='News is $ {}'.format(output))


if __name__ == "__main__":
    app.run(debug=True)
4

0 回答 0