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

為{幸葍}努か 提交于 2020-03-03 11:55:44

问题


Ive updated my Python version from 3.5.4 to 3.6.6 (in Anaconda 3) and now the line

    from sklearn.metrics.pairwise import cosine_similarity

causes the following error:

    Traceback (most recent call last):

      File "<ipython-input-3-743ac88bcf9a>", line 1, in <module>
        from sklearn.metrics.pairwise import cosine_similarity

      File "F:\Program Files\lib\site-packages\sklearn\__init__.py", line 64, in <module>
        from .base import clone

      File "F:\Program Files\lib\site-packages\sklearn\base.py", line 13, in <module>
        from .utils.fixes import signature

      File "F:\Program Files\lib\site-packages\sklearn\utils\__init__.py", line 13, in <module>
        from .validation import (as_float_array,

      File "F:\Program Files\lib\site-packages\sklearn\utils\validation.py", line 22, in <module>
        from ..utils.fixes import signature

      File "F:\Program Files\lib\site-packages\sklearn\utils\fixes.py", line 83, in <module>
        from scipy.special import boxcox  # noqa

      File "F:\Program Files\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
        from ._ufuncs import *

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

Im on Windows 7, 64-bit; previously the line worked fine, and other packages (Pandas, Numpy etc) still work, so it doesn't appear to be a PATH issue as some have suggested.

Ive seen numerous similar questions but all solutions have so far failed. E.g.

  • roll the installation back to Python 3.5.4,
  • uninstall & re-install Pandas, Numpy, Scipy and Sklearn, also update MKL/MKL-RT.
  • The changes suggested in Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found were already implemented

Does anyone have any further suggestions (specific to Anaconda etc)?


回答1:


I solved it, and (in my case) the problem was scipy, not sklearn. What i did was uninstall scipy with conda: conda remove --force scipy, and then install it with pip: pip install scipy. That worked for me.



来源:https://stackoverflow.com/questions/52612657/sklearn-importerror-dll-load-failed-the-specified-module-could-not-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!