Python无法导入函数

2024-10-08 18:31:27 发布

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

我有个问题。我已经安装了Rasa和所有必需的软件包。但当我试图运行我的代码时,会出现以下错误:

from rasa_core.channels.console import ConsoleInputChannel
ImportError: cannot import name 'ConsoleInputChannel' from 'rasa_core.channels.console' (/usr/local/lib/python3.7/dist-packages/rasa_core/channels/console.py)

我做错什么了?在


Tags: 代码namefromcoreimportusrlocal错误
1条回答
网友
1楼 · 发布于 2024-10-08 18:31:27

看起来您的代码是为较旧版本的Rasa编写的,而不是您用来运行它的代码。根据迁移指南,^{cd1>}已被删除。https://github.com/RasaHQ/rasa/blob/master/docs/core/old-core-migration-guide.rst#changes-to-input-and-output-channels处的文档说:

ConsoleOutputChannel and ConsoleInputChannel have been removed. Either use the run script to run your bot on the cmdline, or adapt the serve_application function to run from a python script.

如果您知道需要哪个版本,您可以尝试安装旧版本,或者您可以调整程序以使用当前版本的Rasa。

相关问题 更多 >

    热门问题