1

我正在尝试从telethon运行以下示例代码:

from telethon import TelegramClient, sync

# These example values won't work. You must get your own api_id and
# api_hash from https://my.telegram.org, under API Development.
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'

client = TelegramClient('session_name', api_id, api_hash)
client.start()

但我收到以下错误:

[root@server cli]# python3.6 client.py
Traceback (most recent call last):
  File "client.py", line 1, in <module>
    from telethon import TelegramClient, sync
ImportError: cannot import name 'sync'

我也尝试使用以下命令安装同步:

pip3.6 install sync

关于这个问题的任何想法?

4

1 回答 1

1

原来包安装被破坏了。所以,我重新安装了软件包,现在一切正常。

卸载电视节目:

pip uninstall telethon

并再次安装:

pip install telethon
于 2018-06-29T22:24:29.680 回答