Khizar Haider
Khizar Haider

Reputation: 91

Python Interpreter Not Found on VS Code

I accidentally deleted python, then when I reinstalled it, VS Code kept showing me an error saying

You need to select a Python Interpreter before you start debugging. Tip: click on "Select Python Interpreter" in the status bar."

When I go to the bar there are no interpreters available. When I try on someone else's laptop it shows the interpreters.

Python is already in the PATH.

Upvotes: 9

Views: 77100

Answers (7)

Danny Varod
Danny Varod

Reputation: 18069

Selecting Python interpreter (bottom right of screen) and selecting test framework (unittest/pytest) from VSC settings, then closing VSC and reopening it solved the problem for me.

Upvotes: 0

qbone
qbone

Reputation: 11

I was unable to select the Python: Select Interpreter.

It was solved instead by disabling the python debugger extension, then disabling and re-enabling the python extension.

After that I could follow the steps in Mia's answer.

Upvotes: 1

I completely uninstalled my python and re-installed the latest version (which currently is 3.9.6), and it perfectly worked.

Upvotes: 0

R Desilva
R Desilva

Reputation: 11

I uninstalled the latest Python version (ex. v3.10.2) and re-installed an older version (ex. v3.9.7), and it's working perfectly without no issues.

Upvotes: -1

RideCut
RideCut

Reputation: 1

I had to do the following and it worked:

  1. Re-install Python from VS Code Extensions.
  2. Disable and Re-Enable the Extension one more time.
  3. Restarting my PC.

Upvotes: 0

Dharmin S
Dharmin S

Reputation: 111

Check whether you have the Python extension installed in your Visual Studio Code. If it is already installed, then try to disable/enable it.

Upvotes: 6

Mia Wu-MSFT
Mia Wu-MSFT

Reputation: 366

You should find and choose python interpreter manually:

  1. Ctrl+Shift+P, Python: Select Interpreter

  2. Enter interpreter path – Find (or enter the path manually) enter image description here

  3. Find your python.exe in your python installation path, the default path is like:

    C:\Users\***\AppData\Local\Programs\Python\Python37
    
  4. Check if the problem is solved

OR you can take the following steps to override settings for interpreter

  1. Ctrl+Shift+P, Preferences: Open Settings(JSON)

  2. Copy your python path

  3. Add line like this, paste and replace the path:

    "python.pythonPath": "C:\\Users\\***\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe"
    
  4. Ctrl+S to save the changes.

See more for macOS/Linux:
https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter

Upvotes: 11

Related Questions