![](/img/trans.png)
[英](python-telegram-bot) AttributeError: 'Update' object has no attribute 'bot"
[英]AttributeError: module 'telegram' has no attribute 'Bot'
我正在使用 python 并收到此错误。
当我运行它时,出现:“AttributeError: module 'telegram' has no attribute 'Bot'” 有什么解决办法吗?
我假设您指的是python-telegram-bot并且您仅使用python-pip
进行软件包安装(而不是您操作系统的软件包管理器):
~> pip3 list | grep -i telegram
python-telegram-bot 11.1.0
pip install --user --force-reinstall python-telegram-bot
telegram.py
。请注意,您的文件名 (.py) 与您的包名不同。
我遇到了同样的问题,并在相关的 GitHub 问题中发表了评论,如果你在test.py
文件中运行代码,你会遇到这个问题。 也许它会为你解决问题。
如果您使用的是 PyCharm,并且您是编程新手,要添加模块,您需要在此处将其添加到您的项目中:在此处输入图像描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.