nltk.download()下载失败怎么办
这篇文章主要为大家展示了“nltk.download()下载失败怎么办”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“nltk.download()下载失败怎么办”这篇文章吧。
成都创新互联是网站建设技术企业,为成都企业提供专业的成都网站制作、网站设计,网站设计,网站制作,网站改版等技术服务。拥有十多年丰富建站经验和众多成功案例,为您定制适合企业的网站。十多年品质,值得信赖!
安装nltk
pip install nltk
安装完之后,报错
>>> from nltk.corpus import brown >>> brown.words() Traceback (most recent call last): File "D:\soft\python3.6\lib\site-packages\nltk\corpus\util.py", line 80, in __load try: root = nltk.data.find('{}/{}'.format(self.subdir, zip_name)) File "D:\soft\python3.6\lib\site-packages\nltk\data.py", line 675, in find raise LookupError(resource_not_found) LookupError: ********************************************************************** Resource [93mbrown[0m not found. Please use the NLTK Downloader to obtain the resource: [31m>>> import nltk >>> nltk.download('brown') [0m Searched in: - 'C:\\Users\\WYXCz/nltk_data' - 'C:\\nltk_data' - 'D:\\nltk_data' - 'E:\\nltk_data' - 'D:\\soft\\python3.6\\nltk_data' - 'D:\\soft\\python3.6\\share\\nltk_data' - 'D:\\soft\\python3.6\\lib\\nltk_data' - 'C:\\Users\\WYXCz\\AppData\\Roaming\\nltk_data' ********************************************************************** During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "D:\soft\python3.6\lib\site-packages\nltk\corpus\util.py", line 116, in __getattr__ self.__load() File "D:\soft\python3.6\lib\site-packages\nltk\corpus\util.py", line 81, in __load except LookupError: raise e File "D:\soft\python3.6\lib\site-packages\nltk\corpus\util.py", line 78, in __load root = nltk.data.find('{}/{}'.format(self.subdir, self.__name)) File "D:\soft\python3.6\lib\site-packages\nltk\data.py", line 675, in find raise LookupError(resource_not_found) LookupError: ********************************************************************** Resource [93mbrown[0m not found. Please use the NLTK Downloader to obtain the resource: [31m>>> import nltk >>> nltk.download('brown') [0m Searched in: - 'C:\\Users\\WYXCz/nltk_data' - 'C:\\nltk_data' - 'D:\\nltk_data' - 'E:\\nltk_data' - 'D:\\soft\\python3.6\\nltk_data' - 'D:\\soft\\python3.6\\share\\nltk_data' - 'D:\\soft\\python3.6\\lib\\nltk_data' - 'C:\\Users\\WYXCz\\AppData\\Roaming\\nltk_data' **********************************************************************
原因是需要执行nltk.download()
下载数据集
# 更改下载目录 nltk.download(download_dir=r'D:\soft\python3.6\share\nltk_data')
又试: nltk.download(),but:
于是去官网直接下载:https://github.com/nltk/nltk_data。
下载packages就好,放入之前报错中的目录,记得这里将 packages 重命名成 nltk_data。
以上是“nltk.download()下载失败怎么办”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
本文题目:nltk.download()下载失败怎么办
分享URL:http://lswzjz.com/article/giipcp.html