0

我正在使用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

如何修复此错误?

4

0 回答 0