首页 > 解决方案 > 没有安装 linter pylint vscode

问题描述

我知道这个问题有多个版本,我已经尝试过发布在这些线程上的解决方案,但它们似乎没有帮助:(

我在 Ubuntu VM 中安装了 VS Code。我似乎无法让 python linter 工作。即我收到一条消息说

Linter pylint is not installed 

我很确定 pylint 已安装在 VM 上,因为当我运行时,which pylint我有一个有效的输出。

以下是 和which pythonwhich pylint输出

/usr/bin/python
/home/rakshak/.local/bin/pylint

我在 VS Code 的用户设置和工作区设置中有以下内容

// Place your settings in this file to overwrite the default settings
{
       "python.linting.pylintEnabled": true,
       "python.linting.pylintPath": "/home/rakshak/.local/bin/pylint",
       "python.pythonPath": "/usr/bin/python"
}

标签: visual-studio-codevscode-settings

解决方案


所以,原来这只是一个权限问题!

当我收到pylint not installed消息时,我看到了一个“安装 pylint”的按钮,它运行

sudo pip install pylint

这将 my 的所有者更改.local/lib/为 root 并使其无法访问 vscode。

的输出ls -ld ~/.local/lib/

drwx------ 3 root root 4096 Sep 24 10:49 /home/ userName /.local/lib/

与我的组和用户一起运行 chown 解决了这个问题。

sudo chown -R group:user ~/.local

现在ls -ld ~/.local/lib/读取的输出

drwx------ 3 userGroup 用户名4096 Sep 24 10:49 /home/rakshak/.local/lib/


推荐阅读