Visual Studio代码,使用WSL进行Python linting(适用于Linux的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": [],

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

最佳答案
切换回窗口后,我一直在努力解决这个问题,我发现了这个:
https://github.com/Microsoft/vscode-python/issues/67

哪个是涵盖这个确切场景的开放性问题,在评论中有几个黑客和解决办法,但由于它现在是一个可见且高优先级的问题,真正的解决方案是等待vs代码中的修复.

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

这将运行Linux版本的VS代码,因此它将使用安装在那里的环境进行linting.

转载注明原文:Visual Studio代码,使用WSL进行Python linting(适用于Linux的Windows子系统) - 代码日志