Home > Net >  VScode,The Python path in your debug configuration is invalid
VScode,The Python path in your debug configuration is invalid

Time:07-18

enter image description here

I keep getting this error. Other have faced this issue and have asked this question already and I have tried every single solution that was posted but I still get the error. Things I have tried to solve this problem:

  • Uninstalled and reinstalled python and VScode.
  • ctrl shift p and added python interpreter to path.
  • manually entered path in launch.json. "python": "C:\Users\saura\AppData\Local\Programs\Python\Python310\python.exe"

Not sure what more can I do. I messed around with conda, julia, anaconda without having much knowledge about it and I have a feeling that might be the issue. I did however uninstalled everything regarding conda, julia, anaconda. If anyone has any idea what could I do, I would really appreciate it.

CodePudding user response:

Post the content of your launch.json file so that people can take a look at it.

You Configuration Should Look Like This:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Base",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [],
            "python": "path-to-python"
        }
    ]
}

From menu bar of VS Code (Run), go to Open Configurations and paste above content after replacing path-to-python with yours.

Make sure you are using edited debug configuration when launching the debug for script.

CodePudding user response:

Look in the lower right corner of your interface, where you are prompted to choose a python interpreter.

enter image description here

You should just click there or use Ctrl Shift P to open the command palette and choose Python:Select Interpreter, then choose the appropriate python interpreter.

I know you have tried many ways for this. But here's the problem, you haven't selected a python interpreter for vscode. If none of the methods work, try reinstalling the python extension.

Also, if the "python" configuration in your launch.json is the same as you showed in your question. then it is wrong, you should use / or \\. like this:

// Example 1
"python": "C:/Users/saura/AppData/Local/Programs/Python/Python310/python.exe"

// Example 2
"python": "C:\\Users\\saura\\AppData\\Local\Programs\\Python\\Python310\\python.exe"
  • Related