ImportError上的问题:numpy.core.multiarray导入失败

时间:2019-06-21 12:10:04

标签: python django numpy scikit-learn pycharm

我正在pychrm上与django一起工作,我已经测试了一个项目,并且一切正常,但是当我尝试使用另一个项目并返回第一个项目时,那里出现此错误

  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\appweb pred21\predict\urls.py", line 3, in <module>
    from . import views
  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\appweb pred21\predict\views.py", line 3, in <module>
    from ml_code.ml_process import server_predictor
  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\appweb pred21\ml_code\ml_process\server_predictor.py", line 3, in <mod
ule>
    from sklearn.externals import joblib
  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\site-packages\sklearn\__init__.py", line 134, in <module>
    from .base import clone
  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\site-packages\sklearn\base.py", line 13, in <module>
    from .utils.fixes import signature
  File "C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\lib\site-packages\sklearn\utils\__init__.py", line 9, in <module>
    from .murmurhash import murmurhash3_32
  File "sklearn\utils\murmurhash.pyx", line 26, in init sklearn.utils.murmurhash
  File "__init__.pxd", line 1000, in numpy.import_array
ImportError: numpy.core.multiarray failed to import

那么问题出在哪里呢?

1 个答案:

答案 0 :(得分:2)

private lazy var loaderMoreView: UIView = {
    let loaderView = UIActivityIndicatorView(style: .whiteLarge)
    loaderView.color = UIColor.gray
    loaderView.startAnimating()
    return loaderView
}()

您需要使用test = models.ForeignKey(Test,on_delete=models.CASCADE) 关键字来定义on_delete关系,它在ForeignKey的新版本中是必需的。

更改后不要忘记做Djangomakemigrations