Using pylint with Visual Studio Code

Viewed 2525

I downloaded Visual Studio Code the other day and I decided to use it with pylint.

For some odd reason I couldn't set the python interpreter to python 3 from the palette (Shift + Ctrl + P) but I set the path to it from the settings and it seems to have done the job. However, pylint underlines almost everything. All of my imports are underlined with the error message:

[pylint] E0401:Unable to import 'my.import'

I read a couple of threads on this topic and the main suggestions are to set the correct python path and path to pylint, which I have done with 0 success. I tried removing it pip3 remove pylint and reinstalling it, however, it still did not fix my issue.

2 Answers

You may try setting "python.linting.pylintPath" key separately.

In settings.json you can set like this;

"python.linting.pylintPath": "/home/user/.local/bin/pylint"

user will be your user name of course

if you use linux and want to find exact location of pylint you can run which pylint command in terminal

To solve this issue, you can set the path to your python installation in preferences-> settings python.pythonPath.

Related