Reputation: 5456
I am using pylint with Visual Studio Code, and it works fine, with the exception that it marks error in all import
clauses that are not modules from python or from my project. It marks error with imports from Django, Django Rest Framework, etc.
How can I configure pylint to recognize these libraries that are installed and working (I don't get any error from python)?
Upvotes: 0
Views: 512
Reputation: 29719
You need to set the correct Python interpreter.
See the VS Code docs > Select and activate an environment.
Basically:
You can confirm the current environment selected from the status bar.
You can also check it from the workspace's settings.json, where a python.pythonPath
settings gets automatically added/updated every time you switch environments:
{
"python.pythonPath": "/Users/gino/.venvs/test-django/bin/python",
...
}
Pylint basically checks the currently activated environment for import errors.
If the errors does not instantly disappear, try reloading VS Code.
Upvotes: 1