繁体   English   中英

每次我启动 VS Code 时“Linter pylint 没有安装”

[英]“Linter pylint is not installed” every time I start VS Code

每次我启动 VS Code 时,都会弹出一个带有红十字的小 window 说“Linter pylint 未安装”,其中包含三个Install选项, Select LinterDo not show again 但是,当我单击Install时,它会在/usr/bin/python上打开集成终端并告诉我“要求已经满足,正在跳过升级”。 当我点击Select linter pylint时,我可以在列表末尾找到 select pylint。 which pylint返回“找不到 pylint”。 这让我发疯。 它最近才开始出现这种行为不端,但我不确定是什么原因造成的。 我已经尝试了这个线程中的所有答案Linter pylint is not installed和这个线程Getting error message "Linter pylint is not installed"但没有任何变化。 pip3 install pylint返回“要求已经满足”。 我需要一些帮助。

这些是我的 linting 设置:

  "python.pythonPath": "/usr/bin/python",
  "python.linting.enabled": true,
  "python.linting.pylintEnabled": true,
  "python.linting.pylintPath": "python -m pylint",
  "python.linting.pylintArgs": [
    "--extension-pkg-whitelist=pygame",
    "--errors-only"
  ],```

在 VS Code window 的左下角,它告诉您编辑器当前正在使用哪个 python 环境来评估/运行您的代码。 (这只会在您在编辑器中打开 Python 文件后出现。)您可以单击它进行更改。

您需要确保 pylint 是 pip 安装在您选择的相同环境中。 这可能是问题所在!

编辑:在我的settings.json ,我没有"python.pythonPath": "/usr/bin/python" 如果它与您选择的 Python 环境不同,可能会导致问题?

请在当前选择的Python环境中检查安装的模块“Pylint”是否安装成功:

  1. 请使用命令“ python --version ”查看VSCode终端当前所在的Python环境:

    在此处输入图像描述

    如果结果与 VSCode 左下角显示的不一致,请使用快捷键 Ctrl+Shift+` 打开一个新的 VSCode 终端,它会自动进入选中的终端。

2.我们可以使用“ pip show pylint ”来检查“Pylint”的安装位置:

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM