Set-Up
Welcome to an Introduction to Python with Telegram Bots. To begin, we must first set up the python programming language12 and the python-telegram-bot library. Please complete these installation before the workshop.
Instructions for Windows and macOS operating systems follow3. If you run into any problems, you may contact through telegram:
Windows
Download the latest Python 3 package from the official website.
Run the installation with the default configuration. Take note of where python is being installed, we will need this later. Take a screenshot of it, or write it down somewhere.
After the installation has completed, we will need to add the python package manager to the system path, in order to install the python-telegram-bot package. First, find the 'advanced system settings' through the control panel. We recommend you use the search function.
Then, click on 'environment variables'.
Select the 'Path' variable, and click edit.
Click on new. Here, we enter the path to pip3, the Python 3 package manager. The path should look something like this,
C:\Users\<your_username>\AppData\Local\Programs\Python\Python<version-number>\Scripts
Do not simply copy and paste the above. Remember in the second step when we said to take note of where python is being installed? This is just the "Scripts" folder within that location. So, from the first step, simply add in "\Scripts"
.
(Refer to where Python was installed in the second step. Then, add \Scripts
to the end of that.)
Be careful though, as adding in the wrong path will not produce an error in this step. Rather, the later steps will fail. If you want to make sure, you can navigate to the AppData
folders by typing in %appdata%
in the windows search menu.
You should have something that looks like this. Press 'OK' on everything, and proceed on to the next step.
Open up the windows command prompt. You can do this by searching for the application 'Command Prompt', or by opening up the run window with the Windows Key + R
, and typing in cmd
.
Enter the following command to execute the installation.
pip3 install python-telegram-bot
If your installation has been successful, it'll look something like this!
macOS
- Download and install python version 3.6.4 from the website https://www.python.org/downloads/mac-osx/.
- Download and install python-telegram-bot.
Open your terminal (just search for "terminal"). Just type in the following line to install:
pip3 install python-telegram-bot
-
To be more precise, this is the CPython interpreter for the python programming language. This tells the computer how to 'make sense' of python code. ↩
-
We are using Python 3, which is a version of python. Make sure that you're not getting Python 2! ↩
-
If you're able to run an OS that is not Windows or macOS (ABSOLUTELY PROPRIETARY), then I assume you can handle the installation by yourself. ↩