Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Invalid python interpreter selected" prompt in VSCode

I've been trying to setup my Python workspace on Visual Studio Code but the software doesn't seem to pick up the fact that I have Python installed, and keeps telling me to install Python. I've tried manually adding the path of the .exe file but the "invalid interpreter prompt" shows up every single time. Just to proof I'm having the correct path in the settings here's a screenshot of the settings.json file:

screenshot of the settings.json file

and the command prompts I used to obtain the path:

screenshot of the command prompts

NB: I tried reinstalling both VSCode and Python through the instructions from the command palette, and ran VSCode as administrator but nothing made a difference. I added the python.exe file location to PATH as well.

like image 700
J930911 Avatar asked Sep 02 '25 07:09

J930911


2 Answers

On my device (VSCode 1.71.2, Python extension 2022.14.0) I could solve the problem by clearing the python interpreter setting.

For this, use Ctrl+Shift+P to open the command palette. Then, enter Python: Clear Workspace Interpreter Setting. On the next panel, select to delete all.

After this, you should be able to select an interpreter by entering Python:Select Interpreter in the command palette.

like image 136
Pascalco Avatar answered Sep 04 '25 20:09

Pascalco


First, make sure you have the python extension installed.

Then follow the steps below to choose an interpreter for vscode:

  1. Use Ctrl+Shift+P to open the command palette

  2. search for Python:Select Interpreter (or click select interpreter in the lower right corner)

    enter image description here

  3. If the panel shows an interpreter, select the available interpreter. If the panel doesn't have an interpreter option. Please select the first item Enter interpreter path

    enter image description here

  4. Then paste the full path to your python.exe (or go to explorer by selecting Find and select your python.exe)

    enter image description here

If it still fails, try installing the pre-release python extension.

enter image description here

like image 44
JialeDu Avatar answered Sep 04 '25 20:09

JialeDu