Installing Python on Windows

Before installing python, the ideal thing when the operating system is Windows is to install a virtual machine that allows us to use all Linux distributions, use applications, utilities and Bash command line tools while on Windows. To do this, the recommendation is to install the Windows Subsystem for Linux (WSL)

WSL installation Link to heading

Open PowerShell or the Windows command prompt, it is important that you run it as administrator. Once opened, type the following command:

wsl --install

When you execute the command, restart the machine. This way wsl will be installed with Ubuntu as the default Linux distribution

Once WSL is installed, you must create an account for the Linux distribution. The following link is a guide to create your username and password https://learn.microsoft.com/es-es/windows/wsl/setup/environment#set-up-your-linux-username-and-password

Python installation Link to heading

Next, type the following command in the Ubuntu terminal (WSL):

Step 1 Link to heading

Update the package list.

sudo apt update

Step 2 Link to heading

Install a package required to add software repositories to your system.

sudo apt install software-properties-common

Step 3 Link to heading

Add the Dead Snakes PPA repository to your system. This repository contains newer versions of Python than those found in the official Ubuntu repositories.

sudo add-apt-repository ppa:deadsnakes/ppa

Step 4 Link to heading

Update the package list again, this time including packages from the Dead Snakes PPA repository.

sudo apt update

Step 5 Link to heading

Install Python3 in its most recent version.

sudo apt install python3.X

You can also replace the X with the specific version you want to install.

Step 6 Link to heading

Check the version and that it has been installed correctly.

python3 --version

Step 7 Link to heading

Run python in terminal

python3

Now you can program with python in your console and to exit press ctrl+D.

We recommend that you research code editors so that you can choose the one you prefer.

<< Python Installation on Ubuntu Python Installation on macOS >>