在 VSCode 中使用 Flake8...?

Using Flake8 in VSCode...?

我的 VSCode 使用本地安装的 anaconda 环境,在默认目录下,将其放置在 Program Files 中。因此,我无法通过 VSCode 安装 flake8,出现权限错误。如果我在本地更新我的 conda 环境以安装 flake8,有人知道 VSCode 是否识别并能够使用该软件包吗?

是的,会的。您必须将 flake8 安装到您指定为 VSCode.

项目解释器的每个环境中

通常是的。但如果它对你不起作用,那么你可以尝试指定 flake8 的绝对路径并像这样显式启用它:

"python.linting.flake8Enabled": true,  
"python.linting.flake8Path": "path/to/flake8",  

您甚至可以指定您的 conda 环境的路径:

"python.condaPath": "path/to/condaenv/",

你有没有试过:

  1. ctrl + shift + p
  2. write "select linter" then click on it
  3. click on flake8

也许这有帮助。