Tutorials

How to install Python on your PC

In this tutorial, you will learn how to easily and quickly install Python on your personal computer. Although the guide is written for Windows, the basic principles are still the same for other operating systems.

Why Python?

Python is a high-level, general-purpose programming language. Considered among the easiest programming languages for beginners to learn, it is versatile, and powerful. Python works on any platform, including Windows, Mac, Linux, and Raspberry Pi. It is widely used to automate tasks and conduct data analysis. It takes just a bit of your imagination, for unlimited possibilities.

Before starting

There are at least three different ways to install Python.

First way is to install is as part of Anaconda package.

https://www.anaconda.com/products/distribution

This distribution platform includes the Python itself, with thousands of librairies and a bunch of IDEs (Integrated Developpement Environment).

Although this might be useful for scientists and lab researchers, this package is heavy and will take a lot of your disk space, as well as other computer resources, as it runs in the background.

So, if you a beginner, this is not for you. Even if you are an advanced programmer, you might rather consider a customizable installation, based on your specific needs, instead of having hundreds of libraries which you will never use.

Second way is to install all individually.

This is for you if you plan to use Python with IDE like Atom, Visual Studio Code, or PyCharm.

The third way is for you, if you plan to use Spyder as your primary IDE.

Personally, I like Spyder, and I will guide you following this way. This is a hybrid mode, including some things from First Way and the Second Way.

Let’s do it!

  1. Download and install the latest version of the official Python distribution.
    https://www.python.org/downloads
  2. Download and install the Miniconda, which is a small, bootstrap version of Anaconda.
    https://docs.conda.io/en/latest/miniconda.html
    It is required for using Spyder IDE. It also comes with Python, but not the latest version. That’s why the step 1 is necessary.
    Note:
    If you are not interested in Spyder, stop here and install your preferred IDE for Python instead.
  3. Download and install Spyder.
    https://www.spyder-ide.org
  4. Verify your Python installation.
    Open Windows PowerShell command prompt and type in:
    python --version
    If you’ll get an error, saying that this command is not recognized, then you must add your Python installation location into System Environment PATH Variable. See below.

How to Add Python to your PATH System Variable

Type Windows Key + X on your keyboard. Then choose System.
This will open your System Settings screen. From there, go to: Advanced System Settings>Environment Variables. From System Variables list, choose Path and click on Edit. Click on New, add your Python installation root folder location and click Ok. Close all related windows, return to your PowerShell and check your Python version, as above.

Configure Spyder to work with your latest version of Python interpreter

Open Spyder, go to Tools>Preferences>Python Interpreter

Choose your Python interpreter, installed in the step 1.
The default install location is normally the following:
C:/Users/хххх/AppData/Local/Programs/Python/PythonXXX/python.exe

Congratulations! Now you have your Python installed.

Bonus

While developing, you will have to install additional Python packages.

To do so, you must use your Windows PowerShell command prompt.

Let’s say we want to install requests module.

Open the Windows PowerShell and type the following command:

pip install requests

To find Python packages, use the following site:
https://pypi.org