今天在nltk的应用中出现了以下问题:
D:\Program Files (x86)\anaconda\lib\site-packages\sklearn\feature_extraction\text.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping, defaultdict
showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
点击pycharm给出的网址不可访问,那应该怎么解决呢?
错误的提示是因为版本更新发出的警告,可以忽略,不影响后续使用。如果要解决的话找到错误中给出的文件路径,找到text.py文件,原来的文件代码如下:
from collections import Mapping, defaultdict改为from collections.abc import Mapping, defaultdict就可以解决了
本文解决了一个关于nltk应用中遇到的版本冲突问题,详细介绍了如何修改sklearn的text.py文件来避免因从'collections'导入Mapping和defaultdict而产生的DeprecationWarning警告。
1万+





