Guide: Setting Up Visual Studio Code For Python Development On Windows 10/11

Guide: Setting Up Visual Studio Code For Python Development On Windows 10/11

·

3 min read

Visual Studio Code is a very popular code editor that's used in the tech industry. It comes with a lot of extensions and tools and it can run pretty much any language with the help of extensions.

If you're using Python's IDLE, you might find it a bit tiring and tedious to write code with it because you have to save the file each time you make any changes and run the code in a separate window but Visual Studio Code simplifies this process and saves you a lot of time.

Visual Studio Code also has IntelliSense which helps you with hints when you type something. Like when you're typing "pr", it will show "print" as an option. Clicking on the option will automatically finish the sentence and write print.

Having a tool like Visual Studio Code will not only be a time saver but also increases your productivity. However, setting up Visual Studio Code for python is not an easy task on Windows 10/11 for absolute beginners.

In this guide, I'll be showing you how to do that.

Downloading Python From Microsoft Store

If you are on Windows 7, you can directly install Python from the official Python site and get started with development using Visual Studio Code but Microsoft has made it difficult to use Python with Visual Studio Code directly on Windows 10/11.

Also you cannot use PIP if you're not using python that's not downloaded from Microsoft Store.

So in Windows 10/11, you have to install it through Microsoft Store.

Open Microsoft Store and search for Python.

Download the latest Python version.

Installing Python Extensions in Visual Studio Code

Now open Visual Studio Code and click on the extensions tab.

Search for "Python" and you'll find the python extension, install it.

I already have it installed on my machine.

Testing If It Works

Now let's test if our Python code works or not.

Open a new file in Visual Studio Code and Select Python as the language

Then it will ask you to select the interpreter, select the one that you've installed through Microsoft Store.

To know what interpreter is active, you can check the bottom right side to know the selected interpreter.

Now let's run a sample Hello World code to see if our setup is working or not.

Type this into the text area and save the file somewhere on your system

Now click on run and click on run without debugging

Now check the terminal window at the bottom and you'll find that it prints hello world.

This is it. This is how you setup Visual Studio Code for Python development.