pythonvisual-studio-codeubuntu-18.04pylintpycodestyle

Set global path for pylint/pycodestyle in VSCode


I'm trying to set up VSCode to use the user level installed pylint and pycodestyle so that when using a virtual environment I can keep using linting, without actually having it installed in the environment and appearing in the requirements.txt.

According to pip show these are found in /home/alex/.local/lib/python3.8/site-packages however adding

"python.linting.pycodestylePath": "/home/alex/.local/lib/python3.8/site-packages/pycodestyle",
"python.linting.pylintPath": "/home/alex/.local/lib/python3.8/site-packages/pylint/",

To my user settings.json just results in a invalid path error. I can't figure out what to link to here, none of the obvious options (pep8.py or pycodestle.py in that directory, pylint/lint.py, just the pylint directory itself, etc) work for either of them. Can anyone help? I'm using Ubuntu 18.04 if that makes a difference to where they're located.


Solution

  • The path "/home/alex/.local/lib/python3.8/site-packages/ is where the Python code that you installed as a user lives, not where the pylint command lives as the "python.linting.pylintPath" wants. You probably want "/home/alex/.local/bin/pylint`.