为什么 Visual Studio 代码无法识别我的 WSL bash python?
Why doesn't Visual Studio Code recognize my WSL bash python?
我是 运行 Visual Studio Windows 10 上的代码,WSL bash 作为其终端:
"terminal.integrated.shell.windows": "C:/Windows/sysnative/bash.exe"
在 WSL bash 中,我同时安装了 python
(v2.7) 和 python3
(v3.6)。
我已经为 VS Code 安装了 Python 扩展。不幸的是,VS Code 无法识别 WSL bash.
中的任何一个版本的 Python
例如,当我尝试发现测试时,我在 Python 测试日志输出 window 中收到以下错误:
Test Discovery failed:
Error: spawn python ENOENT
如何配置 VS Code 以使用 Python 形式的 WSL bash?
注意:我很确定我需要在 VS Code 的用户设置文件中的 "python.pythonPath"
键中配置指向 Python 的路径。我不确定将哪条路径作为值。
对 WSL 的支持是通过 "WSL - Remote" 扩展完成的。有一个 WSL blog post 涵盖了如何开始。
我是 运行 Visual Studio Windows 10 上的代码,WSL bash 作为其终端:
"terminal.integrated.shell.windows": "C:/Windows/sysnative/bash.exe"
在 WSL bash 中,我同时安装了 python
(v2.7) 和 python3
(v3.6)。
我已经为 VS Code 安装了 Python 扩展。不幸的是,VS Code 无法识别 WSL bash.
中的任何一个版本的 Python例如,当我尝试发现测试时,我在 Python 测试日志输出 window 中收到以下错误:
Test Discovery failed:
Error: spawn python ENOENT
如何配置 VS Code 以使用 Python 形式的 WSL bash?
注意:我很确定我需要在 VS Code 的用户设置文件中的 "python.pythonPath"
键中配置指向 Python 的路径。我不确定将哪条路径作为值。
对 WSL 的支持是通过 "WSL - Remote" 扩展完成的。有一个 WSL blog post 涵盖了如何开始。