Polyglot Programming

Learn C#, Python, and Go through practical examples

Installation guide

Learn how to install Go and Python.

go python

Installation guide

This guide provides step-by-step instructions to install Go and Python on WSL 2 with Ubuntu 24.04 as the default distribution.

Prerequisites (if necessary)

  1. Enable WSL 2

    • Open PowerShell as Administrator and run
      dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
      dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    • Restart your system.
  2. Install WSL 2 and Ubuntu 24.04

    • Run the following commands in PowerShell
      wsl --set-default-version 2
      wsl --install -d Ubuntu-24.04
    • Set up a username and password when prompted.
  3. Update Ubuntu

    • Open the Ubuntu terminal and run
      sudo apt update && sudo apt upgrade -y
  4. Install necessary tools

    • Open the Ubuntu terminal and run
      sudo apt install git

Installing Go

Step 1: Download Go

  1. Visit the official Go download page to get the latest version.
  2. Alternatively, download it directly in the terminal
curl -OL https://go.dev/dl/go1.24.2.linux-amd64.tar.gz

Step 2: Install Go

Remove any previous Go installation:

sudo rm -rf /usr/local/go

Extract the downloaded tarball to /usr/local

sudo tar -C /usr/local -xzf go1.24.2.linux-amd64.tar.gz

Step 3: Configure environment variables

Open the .profile file:

vi ~/.profile

Add the following lines

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go

Save and apply the changes

source ~/.profile

Step 4: Verify installation

Run the following command to check the Go version

go version

Installing Python

Step 1: Verify and optionally install Python 3

Python 3 should already be installed in Ubuntu. Verify with the following command

python3 --version

If the command fails install with

sudo apt install python3

Verify again

python3 --version

Step 2: Install pip

Install Pip, the Python package manager

sudo apt install -y python3-pip

Verify the pip installation

pip3 --version

Step 3: Set up virtual environments

Install the venv module

sudo apt install python3-venv

Create a virtual environment

python3 -m venv myenv

Activate the virtual environment

source myenv/bin/activate