Skip to content

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.

Windows Step 1

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.

Windows Step 2

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.

Windows Step 3

Then, click on 'environment variables'.

Windows Step 4

Select the 'Path' variable, and click edit.

Windows Step 5

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.

Windows Step 6

You should have something that looks like this. Press 'OK' on everything, and proceed on to the next step.

Windows Step 7

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

Windows Step 8

If your installation has been successful, it'll look something like this!

Windows Step 9

macOS

  1. Download and install python version 3.6.4 from the website https://www.python.org/downloads/mac-osx/.
  2. 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

  1. 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. 

  2. We are using Python 3, which is a version of python. Make sure that you're not getting Python 2! 

  3. 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.