How can I add a python interpreter for vs code and check the path of my shell?

1.1k Views Asked by At

I am a beginner with programming. I have a problem with my python interpreter(or that is what I think). I installed vs code as an editor, python extension(from Microsoft) and cmder(mini version) as a terminal. When I run the python code in vs code, a message appear and tells me that: "The terminal process failed to launch: Path to shell executable "C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe" does not exist."

So what I have to do?

2

There are 2 best solutions below

0
f1nch On

Too add a Python Interpreter, you can follow this official documantation

Also, you can follow this QA on Stackoverflow which has been asked before.

2
Steven-MSFT On

It should be C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe instead of C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe.

Have you configured terminal.integrated.profiles.windows in the settings.json file? For example:

  "terminal.integrated.defaultProfile.windows": "PowerShell",
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
      "path": [
        "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
      ],

      "args": ["-NoLogo"]
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    }
  },

Can you remove it or configure it to the right path?

Update:

Sorry for that, I forgot you are a beginner with programming.

Could you find powershell.exe under:

C:\Windows\System32\WindowsPowerShell\v1.0

Or

C:\Windows\SysNative\WindowsPowerShell\v1.0

If you can find it in the System32 folder, you can copy the above configuration to the settings.json file.

You can select File -> Preferences -> Settings to open the settings(shortcut of Ctrl+,). You can refer to the official docs for more details.

If you want to know more, you can refer to this page.