top of page

Python Development Setup Guide for Windows with Linux (WSL)

Updated: Jun 16, 2020

HacLabs is organizing a course on Python, so i thought of creating up a perfect environment which would help you in the long run.


Some points to be noted:

  • This setup would be done on WSL, or some may refer to it as Linux. I am not saying windows is a bad choice, but while doing some advanced functionalities, you may face issues with windows. So this is a safer, future proof bet.

  • As for the IDE, I would be showing mainly on VScode, but I would also show you Pycharm too.

Without waiting any further, let's get started.

If you're on Mac Os:

  • Install Python (link below)

  • Install VSCode (link below)

  • Install Pip, and git, and the bonus (if you want)


[ I do recommend you to install both on Windows and on WSL]

" ➜ " This indicares start of the terminal

Windows

Although I was thinking to make this totally about WSL, this is for them who would like to keep things simple.

  1. First, Download Python

  2. Download an IDE of your choice.

  3. Pycharm

  4. VSCode

After you've downloaded, Install Python, you may get an installer like this


Make sure to check both the boxes below, and don't leave it unchecked as given above! If you did, reinstall again.


To confirm if python is properly installed, go to cmd and type in:

python --version  or,
python3 --version

Output: Python 3.8.3 (or something similar)

P.S. at this stage remember if python or python3 works for you. This depends on system to system. I will use python3 as it works for me, but use python if it works for you.


Do install Pycharm or VSCode as intended.

If you're using Pycharm, running python has 2 ways.

  • Right-click and run

  • Press the play button (this would work only when you have the main function)







You do need to download git, install and the commands to follow to set up git completely are given below. Pycharm does handle the rest so relax and follow along.



For VSCode users, we will cover it in the WSL section.


WSL or Linux

This has always been my preferred setup, and I will be following this setup on most courses. So follow along.


Installing WSL with zsh

If you're a Linux user, you may skip this.

  • Open Powershell as Administrator, copy the code below and paste it in

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

This will install WSL on your system.

  • Open Microsoft Store, and install Ubuntu, and Windows Terminal

  • Restart your PC once, and then press the Windows key, select Ubuntu and go through the basic setup. Do remember the password you type in there.

  • Now, open Windows Terminal and you should see something like this

  • Congrats, you've installed Linux, but we're still not done.

  • Before we continue, Install VSCode on your system

sudo apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

The following commands are optional, for styling purposes only. You can ignore them
sudo apt-get install fonts-powerline
code ~/.zshrc # to customize it
  • Type in the commands in your Ubuntu Terminal. Avoid the last command if you don't want to customize it. Set ZSH_THEME="random", this will generate random themes, if you like one, type in the last command, and set ZSH_THEME="<theme name>"

  • In VSCode extension store, you'll find something called Remote WSL. Install it, also it may pop up on recommendations in VSCode.

Optional for WSL

  1. Installing GIT

sudo apt install git
git --version

git config --global user.name "Anish Bhattacharya"
git config --global user.email "anish@haclabs.org"
git config --global credential.helper cache --timeout=3600

Installing Python on Linux and WSL

So installing python is super easy.

sudo apt-get install python3

Although, chances are python is already installed. Check using,

python3 --version or,
python --version

P.S. at this stage remember if python or python3 works for you. This depends on system to system. I will use python3 as it works for me but use python if it works for you.


Installing pip