【问题标题】:TypeError: descriptor '__subclasses__' of 'type' object needs an argument while trying to import rasa_coreTypeError: 'type' 对象的描述符 '__subclasses__' 在尝试导入 rasa_core 时需要一个参数
【发布时间】:2019-05-02 12:31:22
【问题描述】:

尝试运行一个在我的本地机器上运行完美的程序,但在 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 python-3.x rasa-nlu rasa-core


    【解决方案1】:

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

    来自typing中的相关错误:

    typing 只会在您使用 Python 3.5+ 的情况下使用 Python 升级。由于此问题已在 2016 年 8 月得到解决,我相信任何高于 3.5.3 的 3.5 版本都应该可以工作。

    【讨论】:

    • 我有两台 Ubuntu 16.04 笔记本电脑,都有相同的 tensorflow 2.0.0 版本,都是 python 3.5.2。一个可以毫无问题地导入tensorflow,另一个给出上述错误。错误的来源可能不是 python 版本。它们之间唯一明显的区别是失败者将 TF 安装在虚拟环境中。
    猜你喜欢
    • 2015-12-23
    • 2021-07-29
    • 2018-09-23
    • 1970-01-01
    • 1970-01-01
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多