无法找到sklearn模块

时间:2017-05-25 05:01:01

标签: python-2.7 scikit-learn

from sklearn import datasets
digits = datasets.load_digits()
print(digits)

这是我使用sklearn时遇到的错误。但是,我安装并更新了模块。有没有一种简单的方法通过终端重新安装模块?是否还有其他错误我没有注意到(例如:导入错误的模块)?

Traceback (most recent call last):
  File "/Users/patrickmaynard/scikitLearn/driver/driver.py", line 11, in <module>
    from sklearn import datasets
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/base.py", line 10, in <module>
    from scipy import sparse
ImportError: No module named scipy

1 个答案:

答案 0 :(得分:0)

归功于Evert

即使sklearn模块已完全安装,除非同时安装了scipy模块,否则它将无效。