I’m trying to use python-telegram-bot. (The version of python is 3)
I installed it using
pip install python-telegram-bot
I run a file with the next code:
from telegram import Updater
And I get the next error:
Traceback (most recent call last):
File "pyStart.py", line 1, in <module>
from telegram import Updater
ModuleNotFoundError: No module named 'telegram'
Even when using from python-telegram-bot
, I get an error
File "pyStart.py", line 1
from python-telegram-bot import Updater
^
SyntaxError: invalid syntax
What causes the error?
2
Answers
I think you installed your package in Python2 packages. Try using:
pip3 install python-telegram-bot
for Python 3 environment.Try installing it with pip3:
If that’s not working:
If you don’t have pip3, you can install it with this command:
Alternatively, you can build from source: