我知道这个问题有多个版本,我已经尝试了这些线程上发布的解决方案,但它们似乎没有帮助:(
我在 Ubuntu VM 中安装了 VS Code。我似乎无法让 python linter 工作。即我收到一条消息说
Linter pylint is not installed
我很确定 pylint 安装在 VM 上,因为当我运行时
which pylint
我有一个有效的输出。以下是
which python
的输出和 which 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"
}
最佳答案
所以,事实证明这只是一个权限问题!
当我收到 pylint not installed
消息,我看到一个按钮来“安装pylint”这个运行
sudo pip install pylint
这改变了我的
.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 userName 4096 Sep 24 10:49 /home/rakshak/.local/lib/
关于visual-studio-code - 未安装 linter pylint vscode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52472287/