首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法导入telethon

无法导入telethon
EN

Stack Overflow用户
提问于 2019-06-07 03:24:01
回答 1查看 638关注 0票数 0

让telethon处理我的代码。由于某种原因,我的代码在一段时间后不再工作,所以尝试升级telethon库。现在,甚至不能进口telethon。

按照此处的安装说明进行操作:https://telethon.readthedocs.io/en/latest/basic/installation.html

代码语言:javascript
运行
复制
# pip3 show telethon

Name: Telethon
Version: 1.8.0
Summary: Full-featured Telegram client library for Python 3
Home-page: https://github.com/LonamiWebs/Telethon
Author: Lonami Exo
Author-email: totufals@hotmail.com
License: MIT
Location: /home/XXX/.local/lib/python3.5/site-packages
Requires: pyaes, rsa
Required-by: 

在此之后,尝试基本导入telethon库失败。运行python 3.5.2

代码语言:javascript
运行
复制
# python3 -c "import telethon;"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/xxx/.local/lib/python3.5/site-packages/telethon/__init__.py", line 1, in <module>
    from .client.telegramclient import TelegramClient
  File "/home/xxx/.local/lib/python3.5/site-packages/telethon/client/__init__.py", line 13, in <module>
    from .users import UserMethods  # Required for everything
  File "/home/xxx/.local/lib/python3.5/site-packages/telethon/client/users.py", line 7, in <module>
    from .. import errors, utils, hints
  File "/home/xxx/.local/lib/python3.5/site-packages/telethon/hints.py", line 56, in <module>
    typing.BinaryIO
  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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-07 03:33:32

这是您正在使用的python版本中的一个bug (请参阅https://github.com/python/typing/issues/266);它也是Telethon repo中的一个开放问题(请参阅https://github.com/LonamiWebs/Telethon/issues/1177)。

将你的python升级到最新版本,这个问题就会消失。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56483903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档