TypeError:“ type”对象的描述符“ __subclasses__”在尝试导入rasa_core时需要一个参数

时间:2019-05-02 12:31:23

标签: python python-3.x rasa-nlu rasa-core

尝试运行在我的本地计算机上运行良好的程序,但是在AWS上,我得到了:TypeError:“类型”对象的描述符“ 子类”需要一个参数。 我的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

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

如果您的python 3.5是3.5.3或更低版本,我相信升级应该可以解决它。查看相关问题here

typing中的相关错误开始:

  

typing仅在使用Python 3.5及更高版本的情况下才能使用Python升级。由于此问题已于2016年8月解决,因此我认为高于3.5.3的任何3.5发行版都可以使用。