from chatterbot import ChatBot
chatbot = ChatBot('love')
执行上面的代码时会出错:
C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\chatterbot\storage\
jsonfile.py:26: UnsuitableForProductionWarning: The JsonFileStorageAdapter is not recommended for production environments.
self.UnsuitableForProductionWarning
Traceback (most recent call last):
File "E:\Python\Python 代码\
practice.py", line 4, in <module>
chatbot = ChatBot('love')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\chatterbot\
chatterbot.py", line 83, in __init__
self.initialize()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\chatterbot\
chatterbot.py", line 93, in initialize
nltk_download_corpus('corpora/wordnet')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\chatterbot\
utils.py", line 118, in nltk_download_corpus
find(resource_path)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
data.py", line 635, in find
return find(modified_name, paths)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
data.py", line 621, in find
return ZipFilePathPointer(p, zipentry)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
compat.py", line 366, in _decorator
return init_func(*args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
data.py", line 470, in __init__
zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
compat.py", line 366, in _decorator
return init_func(*args, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\nltk\
data.py", line 986, in __init__
zipfile.ZipFile.__init__(self, filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\
zipfile.py", line 1026, in __init__
self._RealGetContents()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\
zipfile.py", line 1093, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
到底是什么原因啊,而且如何解决这个问题?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/358222
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.