没有为logger找到处理程序" sklearn.datasets.twenty_newsgroups"

时间:2016-11-06 10:59:18

标签: python

我在Python Data Science Essentials一书中运行了第2章的例子。它出现了:

No handlers could be found for logger "sklearn.datasets.twenty_newsgroups"

以下是示例代码:

from sklearn.datasets import fetch_20newsgroups
categories = ['sci.med', 'sci.space']
twenty_sci_news = fetch_20newsgroups(categories=categories)

1 个答案:

答案 0 :(得分:3)

这是因为twenty_newsgroups数据集未在您的系统上下载。

像这样运行你的示例代码。

import logging
from sklearn.datasets import fetch_20newsgroups
logging.basicConfig() # to show logging message of what is happening behind the scene.

categories = ['sci.med', 'sci.space']
twenty_sci_news = fetch_20newsgroups(categories=categories)

它将显示消息幕后发生的事情。尝试进行相应的调试。

希望它有所帮助!