没有安装linter pylint vscode

时间:2018-09-24 03:21:54

标签: visual-studio-code vscode-settings

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

我在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"
}

2 个答案:

答案 0 :(得分:3)

因此,事实证明这只是权限问题!

当我收到pylint not installed消息时,系统提示我“运行pylint”运行该按钮

  

sudo pip install pylint

这将我的.local/lib/的所有者更改为root,并使其无法使用vscode。

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

  

drwx ------ 3根root 4096 Sep 24 10:49 / home / 用户名 /。local / lib /

与我的小组和用户一起跑步,解决了这个问题。

  

sudo chown -R group:user 〜/ .local

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

  

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

答案 1 :(得分:0)

您是否已检查安装了哪个python版本的pylint? 如果您使用的是python 3.6,则设置必须像这样:

"python.pythonPath": "/usr/bin/python3.6"