Pylint加载插件在VS Code中失败

时间:2019-02-28 09:51:57

标签: python visual-studio-code vscode-settings lint

这是我的配置:

"python.linting.pylintArgs": [
    "--load-plugins", 
    "pylint-quotes"
  ],

我用pip和pip3安装了pylint-quotes,但仍然出现错误:

Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/usr/local/lib/python2.7/site-packages/pylint/__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "/usr/local/lib/python2.7/site-packages/pylint/lint.py", line 1274, in __init__
    linter.load_plugin_modules(self._plugins)
  File "/usr/local/lib/python2.7/site-packages/pylint/lint.py", line 500, in load_plugin_modules
    module = modutils.load_module_from_name(modname)
  File "/usr/local/lib/python2.7/site-packages/astroid/modutils.py", line 190, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/local/lib/python2.7/site-packages/astroid/modutils.py", line 232, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = imp.find_module(part, path)
ImportError: No module named pylint-quotes

我正在使用mac。我应该在某个地方指定模块的路径吗?

2 个答案:

答案 0 :(得分:1)

插件名称为 pylint_quotes

"python.linting.pylintArgs": [
"--load-plugins", 
"pylint_quotes"
],

这应该有效。

答案 1 :(得分:0)

您确定两个地方都有相同的python吗?可能是您使用其他python(pip)安装并在VS中使用另一个python的情况。