7

I am running Visual Studio Code on Windows 10 with WSL bash as its terminal:

"terminal.integrated.shell.windows": "C:/Windows/sysnative/bash.exe"

In WSL bash I have both python (v2.7) and python3 (v3.6) installed.

I have installed the Python extension for VS Code. Unfortunately VS Code fails to recognize either version of Python in WSL bash.

For example when I try to discover tests, I get the following error in the Python Test Log output window:

Test Discovery failed:

Error: spawn python ENOENT

How can I configure VS Code to work with Python form WSL bash?

Note: I'm pretty sure I need to configure a path to Python in the "python.pythonPath" key in VS Code's user settings file. I am unsure of which path to put as the value though.

3
  • Quibble re: "bash as its terminal" -- bash isn't a terminal, it's a shell. A terminal does the work of displaying a window, and transmits textual data to or from programs whose output is displayed in that window. Bash itself doesn't know anything about windowing systems, graphics, &c; it's not a terminal at all, purely a shell. Commented Jan 30, 2018 at 20:31
  • 1
    Thanks. Just wanted to stick with VS Code terminology :) Commented Jan 30, 2018 at 20:42
  • 1
    Gotcha. UNIX terminology is a bit different, so this question crosses worlds a bit -- probably for the better that there wasn't need to say either "directory" or "folder" to avoid any holy wars on that topic from drifting in either. :) Commented Jan 30, 2018 at 20:43

1 Answer 1

11

Support for WSL is done through the "WSL - Remote" extension. There is a WSL blog post which covers how to get started.

Sign up to request clarification or add additional context in comments.

3 Comments

It seems that this is supported now? So a better answer would be how to do this now.
@JackStrosahl thanks for noticing that the answer was outdated! I've now updated it.
Excellent, thank you. I was asking because I was trying to do it. Essentially all I was missing was that extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.