簡體   English   中英

Python無法導入函數

[英]Python can't import function

我有個問題。 我已經安裝了 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)

我究竟做錯了什么?

看起來您的代碼是為較舊版本的 Rasa 編寫的,而不是您用來運行它的版本。 根據遷移指南, ConsoleInputChannel已被刪除。 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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM