Sla*_*ast 8 python python-3.x telegram python-telegram-bot telegram-bot
我正在尝试创建一个电报机器人。我试图执行的代码是:
from telegram import ParseMode
Run Code Online (Sandbox Code Playgroud)
但它抛出了这个错误:
ImportError: cannot import name 'ParseMode' from 'telegram'
(C:\ProgramData\Anaconda3\lib\site-packages\telegram\__init__.py)
Run Code Online (Sandbox Code Playgroud)
您能告诉我如何修复这个错误吗?
小智 16
根据版本 20,您需要使用:
from telegram.constants import ParseMode
Run Code Online (Sandbox Code Playgroud)
你必须用这种方式导入:
from telegram.ext import ParseMode
Run Code Online (Sandbox Code Playgroud)
如果问题没有解决:
像这样安装包:
pip 安装 python_telegram_bot
或者
pip install“python_telegram_bot==12.4.2”
| 归档时间: |
|
| 查看次数: |
12654 次 |
| 最近记录: |