Reputation: 383
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?
Upvotes: 2
Views: 1915
Reputation: 8196
Try installing it with pip3:
pip3 install python-telegram-bot
If that's not working:
python3 -m pip install python-telegram-bot
If you don't have pip3, you can install it with this command:
sudo apt update && sudo apt install python3-pip -y
Alternatively, you can build from source:
git clone https://github.com/python-telegram-bot/python-telegram-bot
python setup.py install
git submodule update --init --recursive
Upvotes: 4
Reputation: 622
I think you installed your package in Python2 packages. Try using: pip3 install python-telegram-bot
for Python 3 environment.
Upvotes: 2