Install Python 3.9.1 on WSL

visibility 2,337 access_time 5 months ago languageEnglish

This article summarizes the steps to install Python 3.9.1 on Windows Subsystem for Linux Debian distro. You can also apply them to other similar distros. 

Installation steps

Run the following commands in your WSL terminal.

1) Update package lists

sudo apt update

2) Install dependent libraries

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev

3) Download Python binary package

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

4) Unzip the package

tar -xzf Python-3.9.1.tgz

5) Execute configure script

cd Python-3.9.1

./configure --enable-optimizations

6) Build Python 3.9

make -j 2

7) Install Python 3.9

sudo make install

Verify the installation

Run the following command to install Python 3.9:

$ python3.9
Python 3.9.1 (default, Jan 8 2022, 14:44:10)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.

Make Python 3.9 the default

If you want to make Python 3.9 the default python program, you can follow these steps:

1) Change ~/.bashrc file to add the following line:

alias python='/usr/local/bin/python3.9'

2) And then run the following command to make it effective:

source ~/.bashrc

You can verify it using python command directly:

python --version

Python 3.9.1

References

info Last modified by Raymond 5 months ago copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

timeline Stats
Page index 17.59
More from Kontext
Apache Spark 3.0.1 Installation on Linux or WSL Guide
visibility 4,397
thumb_up 0
access_time 2 years ago
Apache Spark 3.0.1 Installation on Linux or WSL Guide
Apache Hive 3.1.2 Installation on Linux Guide
visibility 5,657
thumb_up 3
access_time 5 months ago
Apache Hive 3.1.2 Installation on Linux Guide
Connect to SQL Server via JayDeBeApi in Python
visibility 8,712
thumb_up 1
access_time 2 years ago