Nibesh Khadka
Khadka's Coding Lounge


Khadka's Coding Lounge

How to Set Default Python Interpreter in VS Code

How to Set Default Python Interpreter in VS Code

A guide on how to set up your Visual Studio Code for Python operations.

Nibesh Khadka's photo
Nibesh Khadka
·Jun 20, 2022·

2 min read

Play this article

Table of contents

Visual Studio Code is one of the most popular IDE for developers. A screenshot of the PYPL Index for VS code is as follows for the US:

image.png The graph contains only IDEs that are common among Python developers, but they are not the only ones on the list.

VS Code can be downloaded from this link:

Important Setup For Python

After the installation, there are a few things that are required to set up if you want to use Python in VS code.

Python Extension

  1. Open Visual studio
  2. Click the extension button on your left
  3. Type “Python”, and you will see the python extension on the top among the list of extensions, choose that.
  4. Click install, it should be enabled automatically, if not enable it.


Python Interpreter

The next thing we need to set up is the default Python interpreter. To do that first we need our Python path.

Find out the path for windows

For Windows users, if you do not know the path, open your command prompt, and then:

  1. Type python to open the Python shell.
  2. Type the following command, be aware of indentation:
import sys
for pth in sys.path:


Copy the path like the one highlighted. Mine is python 3.9, yours can be different.

Now that you know the path, let's set it up in vs code.

Go to File > Preferences > Settings or Press “Ctrl + ,”.


Choose User > Extensions>Python > Python Path and paste the path that we copied earlier. Remember the path is not complete. So, add “\python.exe” in the end.


Now at the bottom left you will be able to see the python interpreter name like in the pic above >>> Python 3.9.4 64-bit <<<

For Linux its simply : /bin/python_Version for instance: /bin/python3

Pylint for Formatting

Its easier to check and reduce errors if they are highlighted. Hence comes Pylint.

  1. On your VS code press Ctrl + Shift + P, to open the command palette.
  2. Type and select “Python: Select Linter”.
  3. Choose PyLint from the list.
  4. Now, your Visual Studio Code is set for Python operations.


Did you find this article valuable?

Support Nibesh Khadka by becoming a sponsor. Any amount is appreciated!

See recent sponsors Learn more about Hashnode Sponsors
Share this