How To Set Up VS Code For Python

Visual Studio Code or VS Code is Microsoft’s flagship code editor that works across Windows, Mac OS, and Linux platforms. Furthermore, it comes for free. It is one of the widely used code editors and IDEs because of its robust set of features.

Before we get started, if you are looking to learn more about JavaScript or other topics, you should really check out SkillShare, you should really check out SkillShare. Skillshare is an online learning platform with courses on pretty much anything you want to learn. To learn more about Skillshare and its vast library of courses and get 30% off, click the link below:

SkillShare – Online Learning Platform

If you are looking to learn how to use arrays to their fullest potential in JavaScript, check out our Complete Guide to Arrays in JavaScript here. It will teach you everything you need to know on creating, using, and manipulating arrays efficiently in JavaScript.

Can You Code Python In VS Code?

Yes! VS Code can be configured for coding Python. Furthermore, it provides a new experience wherein you can use the full power of VS Code in the Python environment while switching between Virtual and Conda environments.

How Do I Setup VS Code For Python?

To set up VS Code for Python, here are a few things you’ll need to install on your system so that you’re able to write code, debug it and run it in VS Code.

Python Interpreter (Latest Version)

To write, debug and run a Python program, you need to set up a Python run-time environment. For this, you’ll need to first download and install Python on your system.

You can install Python on all three operating systems – Linux, Mac OS, and Windows. For this example, we’re going to show you how to do it on Windows.

Go to to download and install Python.

Once you do, you’ll need to check if you’ve installed it right. So open your command prompt and check the version of Python you have installed. If the version number appears, it means that you’ve installed it correctly.

VS Code Python Extension

Considering you’ve already downloaded and installed VS Code on your system, you can now download the Python Extension for the VS Code.

The purpose of installing a Python extension is to create a Python environment within the code editor. Without that, you will be able to write the Python code on the software, but it will not understand or interpret the code.

So there are two ways in which you can download and add the extension to VS Code:

  1. Go to Visual Studio marketplace and download it
  2. In VS Code, search for Python in extensions search bar and install it

The first method is that you go to the link below:

From here, you can simply click the install button, follow the instructions and download the Python extension.

Installing Python extension in VS Code
Installing Python extension in VS Code

The second method is relatively simple. Here, just open your VS Code environment, and on the left side, there’ll be an icon for Extensions. Click on it, type Python in the search bar that appears, and install the extension.

Additional Extensions


Gather extension in VS Code

Gather extension for VS Code will automatically analyze the code dependencies within a notebook and perform the cleanup.

Live Share

Live Share extension in VS Code
Live Share extension in VS Code

The Live Share extension for VS Code will allow you to collaborate with other people and work together on the code.

Additional Packages

A few more packages that you will find helpful while coding Python are given below.


Jupyter extension for VS Code
Jupyter extension for VS Code

This allows you to perform data cleaning and transformation, numerical evaluation, create statistical models, use it for machine learning, and more.


This is used for performing scientific computations in Python. It has got multidimensional array objects, matrices that can be used for various purposes.


This is one of the most widely used packages for machine learning. It has tools for performing clustering, regression, classification, and more.

How Do I Run A Python Code Inside VS Code?

Although you can run your code files outside VS Code, it is better to have the Code Runner extension since it helps you run code files or active code text directly on the VS Code editor.

Code Runner extension for VS Code
Code Runner extension for VS Code

You can search for the Code Runner extension in VS Code and install it as shown in the screenshot above.

Running a Python Script inside VS Code

Running a Python script inside VS Code
Running a Python script inside VS Code
  1. Create a file called
  2. Type the code print (“Hello World”)
  3. Save the file
  4. Press Ctrl + Alt + N or click the Play button on the top right corner to run the file.
  5. You can then press Ctrl + Alt + M to stop running the code.
  6. Alternatively, you can also press F1 and select Run Code to run your code file.

How To Change Python Version In VS Code?

Opening the Command Palette in VS Code
Opening the Command Palette in VS Code
  1. Go to the View menu and select Show Command Palette.
Python: Select Interpreter option in VS Code
Python: Select Interpreter option in VS Code
  1. From here, choose Select: Python Interpreter.
Selecting version of Python in VS Code
Selecting version of Python in VS Code
  1. You see the various versions/interpreters on your system, and selecting one will add an entry to python.pythonpath.

Is Visual Studio Best For Python?

Yes, by far, it is one of the best IDE’s out there, if not the best! Once you install the Python Extension and a few other packages, you can use VS Code’s full power to build your projects/programs.

The three primary advantages are:

  • Code writing becomes much easier due to its robust features.
  • Its speed and performance are impeccable.
  • You only need to download limited packages to fulfill your requirements.
  • It becomes a one-stop-shop for all the things you need to develop a full-fledged program.

Which Is Better For Python Development – VS Code Or PyCharm?

Overall, as an IDE VS Code is much better than PyCharm for the following reasons:

  • VS Code as software is much more lightweight when compared to PyCharm.
  • VS Code’s performance trumps PyCharm by a large margin since it uses a modular approach and uses only the necessary resources.
  • The general resource management is more efficient in VS Code since PyCharm is infamous for hogging too much memory and RAM while being used.

All in all, VS Code is a clear winner because of the factors mentioned above. 

If you want to learn how to set up Atom for JavaScript development, check out my Complete Guide to Setting Up Atom for JavaScript.

Want More Tips and Tricks? Subscribe to our Newsletter!

If you haven’t already subscribed, please subscribe to The Productive Engineer newsletter. It is filled with tips and tricks on how to get the most out of the productivity apps you use every day. We hate spam as much as you do and promise only to send you stuff we think will help you get things done.


Subscribe to our newsletter and stay updated.

Check Out Our YouTube Channel!

How to Use the Outline Tool in Google Docs

We have a YouTube channel now and we are working hard to fill it with tips, tricks, how-tos, and tutorials. Click the link below to check it out!

link to our YouTube page

Do you use the same password for multiple sites? Do you have trouble remembering all your passwords? You should try 1Password! 1Password is secure and allows you to log in to sites and fill forms securely with a single click. I use 1Password for all my passwords and it really makes managing all my passwords simple.

For more information on 1Password and to get a 30-day free trial, go to 1Password at the link below:

1Password – The world’s most-loved password manager

Check out our Resources Page

Check out our resources page for the products and services we use every day to get things done or make our lives a little easier at the link below:

Link to the resources page

Looking to Get Started Blogging or on YouTube?

Getting started can seem daunting and scary (I know it was for me) but it doesn’t have to be. I was very lucky to find a program that that has helped me grow my blog to over 35,000 page views and a YouTube channel that is growing month-over-month.

Project 24 by Income School is the program that I have used. I have been a member for over a year now and just renewed my membership. I cannot recommend Project 24 enough! For more information on Income School, click the link below:

Project 24 byIncome School – Teaching You How to Create Passive Income from Blogs and YouTube


Recent Posts

Setting Up VS Code for Python Development