簡體   English   中英

TypeError: 'type' 對象的描述符 '__subclasses__' 在嘗試導入 rasa_core 時需要一個參數

[英]TypeError: descriptor '__subclasses__' of 'type' object needs an argument while trying to import rasa_core

試圖運行一個在我的本地機器上運行良好的程序,但在 AWS 上我得到: TypeError: descriptor '__subclasses__' of 'type' object needs an argument 我的 pip3 沒有升級到最新版本,但這應該不會導致問題,因為我已經下載了最新版本的 rasa_core。

嘗試使用 pip3 -u rasa_core 重新安裝 rasa_core,還嘗試使用 sudo 附加命令。 這是我得到的錯誤,有人可以幫忙嗎

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/__init__.py", line 5, in <module>
    from rasa_core.train import train
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/train.py", line 11, in <module>
    from rasa_core.domain import TemplateDomain
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/domain.py", line 12, in <module>
    from rasa_core.actions import Action, action
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/actions/__init__.py", line 1, in <module>
    from rasa_core.actions.action import Action
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/actions/action.py", line 9, in <module>
    from rasa_core import events
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/events/__init__.py", line 73, in <module>
    class Event(object):
  File "/home/ubuntu/.local/lib/python3.5/site-packages/rasa_core/events/__init__.py", line 94, in Event
    default: Optional[Type['Event']] = None
  File "/usr/lib/python3.5/typing.py", line 649, in __getitem__
    return Union[arg, type(None)]
  File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
    dict(self.__dict__), parameters, _root=True)
  File "/usr/lib/python3.5/typing.py", line 512, in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
  File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__
    if super().__subclasscheck__(cls):
  File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__
    for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument

有人可以幫忙嗎。

如果您的 python 3.5 是 3.5.3 或更低版本,我相信升級應該可以解決它。 在此處查看相關問題

打字中的相關錯誤:

如果您使用的是 Python 3.5+,則typing只會使用 Python 升級。 由於此問題已於 2016 年 8 月修復,我相信任何高於 3.5.3 的 3.5 版本都應該可以工作。

暫無
暫無

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

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