urig
urig

Reputation: 16841

Why doesn't Visual Studio Code recognize my WSL bash python?

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.

Upvotes: 7

Views: 10161

Answers (1)

Brett Cannon
Brett Cannon

Reputation: 16080

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

Upvotes: 11

Related Questions