Visual Studio代码,使用WSL进行Python linting(适用于Linux的Windows子系统)

bat*_*top 11 python visual-studio-code windows-subsystem-for-linux vscode-settings bash-on-windows

我在64位PC上使用Windows 10.最近,我开始在Windows上使用VS Code和Ubuntu Bash.一切都很好,除了linting.我试图让它与pylint和pep8一起使用,但它们都没有用.我认为这个问题是由于棉绒的位置造成的.但是,我无法弄清楚如何解决问题.您可以检查我的pylint设置:

// Whether to lint Python files using pylint.
"python.linting.pylintEnabled": true,

// Severity of Pylint message type 'Convention/C'.
"python.linting.pylintCategorySeverity.convention": "Information",

// Severity of Pylint message type 'Refactor/R'.
"python.linting.pylintCategorySeverity.refactor": "Hint",

// Severity of Pylint message type 'Warning/W'.
"python.linting.pylintCategorySeverity.warning": "Warning",

// Severity of Pylint message type 'Error/E'.
"python.linting.pylintCategorySeverity.error": "Error",

// Severity of Pylint message type 'Fatal/F'.
"python.linting.pylintCategorySeverity.fatal": "Error",

// Path to Pylint, you can use a custom version of pylint by modifying this 
// setting to include the full path.
"python.linting.pylintPath": "pylint",

// Arguments passed in. Each argument is a separate item in the array.
"python.linting.pylintArgs": [],
Run Code Online (Sandbox Code Playgroud)

我将不胜感激任何帮助.谢谢...

Sam*_*ley 2

切换回 Windows 后,我自己一直在努力解决这个问题,我发现了这个: https: //github.com/Microsoft/vscode-python/issues/67

这是涵盖这个确切场景的开放问题,评论中有一些技巧和解决方法,但由于它现在是一个可见的高优先级问题,真正的解决方案是等待 VS Code 中的修复。

或者,您可以使用本指南在 WSL 环境中安装 VS Code: https://nickjanetakis.com/blog/using-wsl-and-mobaxterm-to-create-a-linux-dev-environment-on-windows

这将运行 VS code 的 Linux 版本,因此它将使用那里安装的环境进行 linting。