当使用名为importrb的chatterb模块时出现错误

2024-04-25 20:20:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我在试着聊天。所以我安装了聊天软件包。 python代码如下:

from chatterbot import TalkWithCleverbot
talk = TalkWithCleverbot()
talk.begin()

但我得到了以下错误:

^{pr2}$

我试着安装jsondb和db包,但是没有用。请帮帮我


Tags: 代码fromimportdb错误talkjsondbchatterbot
1条回答
网友
1楼 · 发布于 2024-04-25 20:20:14

您的错误突出了这样一个问题:对于__init__.py中的调用,没有要从jsondb导入的db对象。在

def __init__(self, name="bot", logging=True):
      from jsondb.db import Database
                  ^^ this doesn't exist

我找到了'ChatterBot' module on GitHub的源代码,似乎作者正在导入的'jsondb'不是从pip安装的。相反,作者希望您使用hisjsondb module that can be found on GitHub.

您可以通过卸载从pip获取的jsondb来解决此问题:

^{pr2}$

安装ChatterBot作者的jsondb模块:

pip install git+https://github.com/gunthercox/jsondb.git

您遇到这个错误是因为ChatterBot作者假设您安装了名为jsondb的包,并且没有以典型的方式包含依赖项。在

相关问题 更多 >

    热门问题