我有与导入错误相同的问题:DLL加载失败:找不到指定的模块(sklearn),但我正在使用Anaconda。我得到的错误在底部。有没有办法在不破坏我的 Anaconda 安装的情况下单独进行卸载/重新安装?
我尝试卸载并重新安装scikit-learn。我即将开始卸载并重新安装 mkl 和 numpy,但这样做也会卸载一大堆其他软件包,此时我最好从头开始重新安装 Anaconda。除了不能保证如果我这样做,我不会再次遇到同样的问题。
值得注意的是,我有第二台安装了 Anaconda 的计算机,它运行良好,所以它一定是我的安装特有的问题,但我还没有设法修复它。
File "C:ProgramDataAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:ProgramDataAnaconda3libsite-packagesspyderutilssitesitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/shaff/Desktop/TUM Sync Folder/Machine Learning/1-decisiontrees and kNN/HW1.py", line 4, in <module>
from sklearn import model_selection
File "C:ProgramDataAnaconda3libsite-packagessklearn__init__.py", line 134, in <module>
from .base import clone
File "C:ProgramDataAnaconda3libsite-packagessklearnbase.py", line 13, in <module>
from .utils.fixes import signature
File "C:ProgramDataAnaconda3libsite-packagessklearnutils__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "C:ProgramDataAnaconda3libsite-packagessklearnutilsvalidation.py", line 18, in <module>
from ..utils.fixes import signature
File "C:ProgramDataAnaconda3libsite-packagessklearnutilsfixes.py", line 144, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:ProgramDataAnaconda3libsite-packagesscipysparselinalg__init__.py", line 113, in <module>
from .isolve import *
File "C:ProgramDataAnaconda3libsite-packagesscipysparselinalgisolve__init__.py", line 6, in <module>
from .iterative import *
File "C:ProgramDataAnaconda3libsite-packagesscipysparselinalgisolveiterative.py", line 7, in <module>
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
我尝试了这个答案并取得了成功。
- 首先卸载 Numpy、Scipy 和 Sklearn。
- 从这里选择你的Numpy + MKL安装程序,并将其放入Anaconda Scripts文件夹中。
-
使用您刚刚下载的安装程序重新安装带有MKL的Numpy。
pip install --upgrade --force-reinstall "numpy-1.10.2+mkl-cp35-none-win32.whl"
-
之后,重新安装 Scipy 和 Sklearn。