导入sklearn.utils._logistic_sigmoid模块时出错

时间:2015-07-25 10:47:17

标签: python scikit-learn

我已经从Christoph Gohlke Unofficial Windows installers安装了scipyscikit-learn,并且以下命令成功运行且没有错误:

>>> import sklearn
>>> import scipy

然后我将尝试sklearn.datasets.load_digits()函数,如链接文档中所示:

from sklearn.datasets import load_digits

但该行引发了一个错误的抱怨,据我所知,_log_logistic_sigmoid未被发现:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from sklearn.datasets import load_digits
  File "C:\Python27\lib\site-packages\sklearn\datasets\__init__.py", line 23, in <module>
    from .twenty_newsgroups import fetch_20newsgroups
  File "C:\Python27\lib\site-packages\sklearn\datasets\twenty_newsgroups.py", line 53, in <module>
    from ..feature_extraction.text import CountVectorizer
  File "C:\Python27\lib\site-packages\sklearn\feature_extraction\__init__.py", line 10, in <module>
    from . import text
  File "C:\Python27\lib\site-packages\sklearn\feature_extraction\text.py", line 29, in <module>
    from ..preprocessing import normalize
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\__init__.py", line 6, in <module>
    from .data import Binarizer
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\data.py", line 19, in <module>
    from ..utils.extmath import row_norms
  File "C:\Python27\lib\site-packages\sklearn\utils\extmath.py", line 23, in <module>
    from ._logistic_sigmoid import _log_logistic_sigmoid
ImportError: DLL load failed: The specified module could not be found.

有人遇到过这个错误吗?如何解决?

如果有帮助的话,我在Windows 8机器上使用python 2.7。

1 个答案:

答案 0 :(得分:1)

通过卸载非官方软件包解决,然后使用以下命令从官方软件包重新安装:

pip install -U numpy scipy scikit-learn