"Unresolved import" error for Pylint in Visual Studio Code
When using the following settings, I encountered an "Unresolved import" for Pylint Import" error:
Even the default Django imports (like from django.db import models), this error will also occur.
Cause
The error may be because Visual Studio Code does not see the Python files of the virtual environment.
Tried solutions
Solution
Add the following settings to your module:
"python.autoComplete.extraPaths": ["path-to-your-code"]
Note
2023 Yearly update:
python-language-server is deprecated. The new closed source LSP Pylance is set up as follows:
"python.analysis.extraPaths": ["path-to-your-code"]
The above is the detailed content of Here are a few titles that fit the content of the article: * \'Unresolved Imports\' Error in Visual Studio Code with Pylint: How to Fix it? * Pylint \'Unresolved Imports\' Error in Visual Studio Code: A Solution for Django. For more information, please follow other related articles on the PHP Chinese website!