How to Set Default Python Interpreter in VS Code

Nibesh Khadka
2 min readApr 16, 2021

Important Setup For Python

There are a few things that are required to be set up if you want to use Python in VS code.

Python Extension

  1. Open Visual Studio Code
  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.
Install Python Extension

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. Open the Python shell with the command python.
  2. Type the following command, and be aware of indentation:
import sys
for pth in sys.path:
print(pth)
Python Sys Paths

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.

  1. Go to File > Preferences > Settings or Press “Ctrl + ,”.
Settings |VS Code

2. Choose User > Extensions>Python > Python Path and paste the path we copied earlier. Remember! the path is still incomplete. So, add “\python.exe” in the end.

Python Path Location| VS Code

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

Thanks For Reading. Follow For More.

--

--

Nibesh Khadka
Nibesh Khadka

Written by Nibesh Khadka

Software Developer, Content Creator and Wannabe Entrepreneur