How to Install Python and VSCode on Windows

Want to get started with Python programming? Here’s a quick, step-by-step guide to installing Python and Visual Studio Code (VSCode) on Windows.

Step 1: Download and Install Python

1. Download Python

  1. Head to the official Python download page.
  2. You should see a big yellow button labeled “Download Python 3.x.x” (the latest version number). Click it to start the download.

    Python Download Page

2. Install Python

  1. Open the downloaded installer file.
  2. Important: Check the box that says “Add Python to PATH”. This makes running Python from the command line easier.
  3. Choose Install Now and let the installer run.
  4. Once the installation finishes, click Close.

    Python Installer - Select "Add to PATH"

3. Verify the Installation

To confirm Python is installed correctly: 1. Open Command Prompt (search “cmd” in the Start menu). 2. Type python --version and hit Enter. – If installed correctly, you should see the Python version number displayed.

Python Successful Install"

Step 2: Download and Install Visual Studio Code (VSCode)

1. Download VSCode

  1. Go to the VSCode download page.
  2. Choose the Windows option to start the download.

    VSCode Download Page"

2. Install VSCode

  1. Open the downloaded installer file.
  2. Follow the on-screen instructions, and when you reach the setup screen, check the following boxes:
    • Add “Open with Code” action to Windows Explorer (optional but useful).
    • Add to PATH (recommended for terminal usage).
  3. Continue with the installation, and when it’s complete, click Finish.

    VSCode Installer Options"

Step 3: Set Up Python in VSCode

1. Open VSCode and Install the Python Extension

  1. Launch VSCode.
  2. Go to the Extensions sidebar (click the four-square boxes icon or press Ctrl+Shift+X).
  3. Search for Python and select the one by Microsoft.
  4. Click Install to add the Python extension.

    VSCode Download Page"

2. Verify Python Extension in a New File

  1. Create a new file by clicking File > New File.
  2. Save it as test.py.
  3. Type a simple line of code like print("Hello, Python!") and save the file.

    VSCode Python Example Script"

3. Run Python Code in VSCode

  1. Right-click on the code and choose Run Python File in Terminal. This will open a terminal at the bottom of VSCode and execute the code.

    • You should see Hello, Python! printed in the terminal.

    VSCode Python in VSCode Success"

That's It!

🎉 Congratulations! You now have Python and VSCode fully set up on your Windows computer!

Keep coding, and check back for more guides to improve your development experience.

Further Reading

Why Catching All Exceptions is a Bad Idea in Python

#blog #python #vscode #tutorial #programming #joeymanani


Sidenote

The application I used to simulate the screenshots was the Windows Sandbox – similar to a VM – and can be installed on your host machine in the builtin program Turn Windows features on or off inside of your start menu.

I realised that I can use FFmpeg to convert PNG screenshots to WebP to compress them and optimize webpage load times. Pretty cool!