前几天我安装了chatterbot,并正在使用网站中提供的代码进行尝试,这是链接:https ://chatterbot.readthedocs.io/en/stable/examples.html
它在 spyder 上运行良好,但是当我尝试直接运行 .py 文件时它没有。
我正在将 python 3.7 与 anaconda 一起使用。
我得到的最初的错误信息是:
from _sqlite3 import *
------------------------------------------------------------------------
ImportError: DLL load failed: The specified module could not be found.
------------------------------------------------------------------------
然后我尝试从https://www.sqlite.org/download.html下载 sqlite dll 文件并将它们放在 anaconda DLL 文件夹中。再次运行文件我得到了不同模块的相同错误:
from . import _mklinit
------------------------------------------------------------------------
ImportError: DLL load failed: The specified module could not be found.
------------------------------------------------------------------------
来自 chatterbot 网站的代码。
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')
trainer = ListTrainer(chatbot)
trainer.train([
"Hi, can I help you?",
"Sure, I'd like to book a flight to Iceland.",
"Your flight has been booked."
])
# Get a response to the input text 'I would like to book a flight.'
response = chatbot.get_response('I would like to book a flight.')
print(response)
.py 文件应该正常运行,但它无法导入 chatterbot 并立即关闭。