Skip to main content
 首页 » 编程设计

python之Sklearn 数据集

2024年10月17日10yxwkf

我正在尝试代码 from sklearn.datasets import load_iris。为此,我在我的 python 2.7.6 中安装了 sklearn 模块,但它显示了很长的错误

Traceback (most recent call last): 
  File "<pyshell#1>", line 1, in <module> 
    from sklearn.datasets import load_iris 
  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 24, in <module> 
    from ..preprocessing import normalize 
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\__init__.py", line 6, in <module> 
    from ._function_transformer import FunctionTransformer 
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\_function_transformer.py", line 2, in <module> 
    from ..utils import check_array 
ImportError: cannot import name check_array 

我想知道安装 sklearn 模块是否足够,还是我遗漏了什么?请帮忙。我也在研究 Win 8.1

请您参考如下方法:

最新版本是 0.18,你为什么要用 sklearn 0.13.1?您已经过时了,可能存在依赖性问题。

如果您想要更轻松的生活,请安装 anaconda。所有版本的包一起工作,不需要编译任何东西。