从sklearn.utils导入改组-DLL加载失败:找不到指定的过程

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从sklearn.utils导入改组-DLL加载失败:找不到指定的过程相关的知识,希望对你有一定的参考价值。

我无法从sklearn加载模块。错误消息显示“ DLL加载失败:找不到指定的过程。”

Python版本:python == 3.7.5

Sickit-learn版本:scikit-learn == 0.21.3

我所做的就是运行以下一行代码。

from sklearn.utils import shuffle

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\__init__.py", line 76, in <module>
    from .base import clone
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\base.py", line 16, in <module>
    from .utils import _IS_32BIT
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
    from .validation import (as_float_array,
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\validation.py", line 21, in <module>
    from .fixes import _object_dtype_isnan
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
    from .eigen import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
    from .arpack import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
    from .arpack import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
    from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.

我还尝试导入sklearn软件包。它也不起作用。

import sklearn

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\__init__.py", line 76, in <module>
    from .base import clone
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\base.py", line 16, in <module>
    from .utils import _IS_32BIT
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
    from .validation import (as_float_array,
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\validation.py", line 21, in <module>
    from .fixes import _object_dtype_isnan
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\__init__.py", line 116, in <module>
    from .eigen import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\__init__.py", line 11, in <module>
    from .arpack import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\arpack\__init__.py", line 22, in <module>
    from .arpack import *
  File "C:\Users\userMe\Anaconda3\envs\environment001\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
    from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
答案

好吧,我切换到python == 3.5.6,然后一切正常。我不确定sklearn为什么不适用于python == 3.6和3.7,但不应该发生。

以上是关于从sklearn.utils导入改组-DLL加载失败:找不到指定的过程的主要内容,如果未能解决你的问题,请参考以下文章

ImportError:无法从 sklearn.utils.validation 导入名称 check_array

ImportError:无法从“sklearn.utils.validation”导入名称“_deprecate_positional_args”

YellowBrick ImportError:无法从“sklearn.utils”导入名称“safe_indexing”

lazypredict.Supervised.LazyClassifier。 ImportError:无法从“sklearn.utils.deprecation”导入名称“_raise_dep_war

由于错误 <<ImportError: cannot import name 'lobpcg' from 'sklearn.utils.fixes' >> 无法导入 SMOTE

ImportError:DLL 加载失败:找不到指定的模块。尝试“从 PIL 导入图像”时