如何在 VSCode 上为 Python 启用 linting?

问题描述

我已经尝试过 command+shift+P 并单击启用。

enter image description here

但是还是不行。我试着打开和关闭它。我似乎无法让它工作。

解决方法

要在 VS Code 中使用 linting,请参考以下内容:

(以 Pylint 为例:)

  1. 请在 VS Code 中当前选择的 python 环境中安装“pylint”:pip install pylint

  2. 请在“settings.json”中使用以下设置:

"python.linting.enabled": true,"python.linting.pylintEnabled": true,

使用:

enter image description here

参考:Linting in VS Code