python – Pylint unresolved import error in Visual Studio Code

python – Pylint unresolved import error in Visual Studio Code

The accepted answer wont fix the error when importing own modules.

Use the following setting in your workspace settings .vscode/settings.json:

python.autoComplete.extraPaths: [./path-to-your-code],

Reference: Troubleshooting, Unresolved import warnings

In your workspace settings, you can set your Python path like this:

{
    python.defaultInterpreterPath: /path/to/your/venv/bin/python,
}

python – Pylint unresolved import error in Visual Studio Code

Alternative way: use the command interface!

Cmd/Ctrl + Shift + PPython: Select Interpreter → choose the one with the packages you look for:

Enter

Leave a Reply

Your email address will not be published. Required fields are marked *