How to Install Python on Windows WSL

In this post, I’ve outlined the steps for installing specific versions of Python on WSL in an easy-to-follow manner.

1. Install Windows Subsystem for Linux and Install Distro

In the Run dialog box, type optionalfeatures and press Enter. A window displaying Windows features will appear. Select ‘Windows Subsystem for Linux‘ from the list, proceed with the installation, and restart the system once the installation is complete.

Once the system is rebooted, in the command prompt, type

wsl.exe –list –online

which will list the available distros. From there, I will select the Ubuntu install.

wsl.exe –install Ubuntu

Once the installation is is finished, you’ll need to define the user name and password.

Anytime you can start the WSL system in the command prompt by typing wsl.exe in the command prompt.

[Resetting the WSL root password]

If you want to reset the password, you will need to start the WSL with the following command:

wsl.exe -u root

passwd root

2. Install Required package for Python

Since we’re going to install python by compiling source files, we’d need to install some dependencies packages like compiler and openssl. First update, the respository and links.

sudo apt upgrade

Install Compilers and packages.

sudo apt-get install libssl-dev openssl make gcc

3. Python Installation

We will download the python from official python site. From there you can select the specific version you want. Here I’ll go with the python3.8.9

Download the python and extract the files.

cd /mnt

wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz

tar xzvf Python-3.8.9.tgz

cd Python-3.8.9/

Now we will have a make file with the configure command which checks system configuration and sets up the build environment accordingly. The process takes some time, so be patient.

./configure

Here, we got the Make file, so now compile the source code and install binaries to the system with the following command.

sudo make install

4. Install Pip (Optional)

pip is an essential tool for Python development as it simplifies the process of managing external libraries and dependencies, making it easier to work with third-party packages and extend the capabilities of your Python projects. You can install it by:

sudo apt install python3-pip

2 thoughts on “How to Install Python on Windows WSL”

  1. [u][b] Привет![/b][/u]
    Где купить диплом по актуальной специальности?
    Мы можем предложить документы ВУЗов, расположенных на территории всей РФ. Документы будут заверены всеми необходимыми печатями и штампами.
    http://ip1.imgbbs.jp/linkout.cgi?url=http://diplomansy.com/
    [b]Успехов в учебе![/b]

  2. ГК Пересвет: как проверить качество винтовых свай перед покупкой
    ГК Пересвет: свая винтовая цена

Leave a Reply

Your email address will not be published. Required fields are marked *