检查sklearn版本时出错

时间:2018-03-10 10:24:54

标签: python python-3.x scipy scikit-learn

我正在使用python练习ML并通过此link访问。 我安装了链接中提到的所有软件包,即scipy,numpy,matplotlib,pandas,sklearn,并实现了以下代码来检查各自的版本和正确的安装,

# scikit-learn
import sklearn
print('sklearn: {}'.format(sklearn.__version__))

但出现以下错误:

Traceback (most recent call last):
      File "VersionCheck.py", line 19, in <module>
        import sklearn
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\__init__.py", line 134, in <module>
        from .base import clone
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\base.py", line 13, in <module>
        from .utils.fixes import signature
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
        from .validation import (as_float_array,
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
        from ..utils.fixes import signature
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
        from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\sparse\linalg\__init__.py", line 114, in <module>
        from .isolve import *
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <module>
        from .iterative import *
      File "C:\Users\HP\AppData\Local\Programs\Python\Python36\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <module>
        from . import _iterative
    ImportError: DLL load failed: The specified module could not be found.

1 个答案:

答案 0 :(得分:0)

要查看已安装的sklearn版本:

from sklearn import __version__
__version--