如何安装python-telegram-bot版本20及更高版本
尝试从官方网站运行示例或电报机器人 - https ://github.com/python-telegram-bot/python-telegram-bot/tree/master/master/examples 已安装:
pip install python-telegram-bot
当我运行示例时,我收到了错误,该版本不兼容。
if __version_info__ < (20, 0, 0, "alpha", 1):
raise RuntimeError(
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
f"{TG_VER} version of this example, "
f"visit https://github.com/python-telegram-bot/python-telegram-bot/tree/v{TG_VER}/examples"
)
它安装了PYPI版本13.12,但示例检查了不同版本V20。因此,错误是合理的。 我如何让榜样工作?
Trying to run examples or telegram bots from official site - https://github.com/python-telegram-bot/python-telegram-bot/tree/master/examples
Installed :
pip install python-telegram-bot
and when i run the example, i got error back that version is not compatible.
if __version_info__ < (20, 0, 0, "alpha", 1):
raise RuntimeError(
f"This example is not compatible with your current PTB version {TG_VER}. To view the "
f"{TG_VER} version of this example, "
f"visit https://github.com/python-telegram-bot/python-telegram-bot/tree/v{TG_VER}/examples"
)
It installs PyPi version 13.12 but example checks different version v20. So, the error is reasonable.
How can I let example working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能您正在使用

v20.0
版本中的示例,将标签更改为v13.12
Probably you are using examples from

v20.0
version, change the tag tov13.12
对我感到羞耻,我花了几天时间得到答案 - 20倍仅是预发行版本!要找到明确的解释,您必须阅读Wiki,甚至不在首页上 - https://github.com/python-telegram-bot/python-telegram-bot/wiki/wiki/introduction-to-to-the-api
这是具有20倍状态和正确安装过程的清晰答案的唯一信息来源。
因此,这是过程 -
pip install python -telegram -bot -u -pre -pre
顺便说一句,您必须检查是否也安装了“电报”软件包。首先卸载它,然后从刮擦中重新安装电报 - 更好的选择。
Shame on me, I spent a couple of days to get the answer - 20x is pre-release version only! To find clear explanation, you have to read WiKi and not even on the first page - https://github.com/python-telegram-bot/python-telegram-bot/wiki/introduction-to-the-API
That was the only source of info with clear answer with 20x status and right installation procedure.
So, here is the procedure -
pip install python-telegram-bot -U --pre
btw, you have to check if "telegram" package installed also. Uninstall it first and then reinstall telegram-bot from the scratch (better with force option).