Chatterbot-没有名为'chatterbot.trainers'的模块-python 3.x

时间:2018-09-02 11:38:06

标签: python python-3.x chatbot chatterbot

我正在使用python 3.x。运行此代码时出现错误:

from chatterbot.trainers import ListTrainer # method to train the chatbot
from chatterbot import ChatBot # import the chatbot

bot = ChatBot('Test')

conv = open('chats.txt', 'r').readlines()

bot.set_trainer(ListTrainer) # set the trainer

bot.train(conv) # train the bot

while True:
request = input('You: ')
response = bot.get_response(request)

print('Bot: ', response)

错误:

module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'chatterbot.trainers'; 'chatterbot' is 
not a package

如何解决此错误?

0 个答案:

没有答案