Pylint "unresolved import" error in Visual Studio Code
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles
--
Chapters
00:00 Pylint &Quot;Unresolved Import&Quot; Error In Visual Studio Code
01:15 Answer 1 Score 349
01:53 Accepted Answer Score 188
02:10 Answer 3 Score 166
02:36 Answer 4 Score 58
03:06 Answer 5 Score 45
03:23 Thank you
--
Full question
https://stackoverflow.com/questions/5393...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #visualstudiocode #pylint
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles
--
Chapters
00:00 Pylint &Quot;Unresolved Import&Quot; Error In Visual Studio Code
01:15 Answer 1 Score 349
01:53 Accepted Answer Score 188
02:10 Answer 3 Score 166
02:36 Answer 4 Score 58
03:06 Answer 5 Score 45
03:23 Thank you
--
Full question
https://stackoverflow.com/questions/5393...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #visualstudiocode #pylint
#avk47
ACCEPTED ANSWER
Score 190
In your workspace settings, you can set your Python path like this:
{
"python.defaultInterpreterPath": "/path/to/your/venv/bin/python",
}
ANSWER 2
Score 171
Alternative way: use the command interface!
Cmd/Ctrl + Shift + P → Python: Select Interpreter → choose the one with the packages you look for:
ANSWER 3
Score 58
This issue has already been opened on GitHub:
Python unresolved import issue #3840
There are two very useful answers, by MagnuesBrzenk and SpenHouet.
The best solution for now is to create a .env file in your project root folder. Then add a PYTHONPATH to it like this:
PYTHONPATH=YOUR/MODULES/PATH
And in your settings.json add:
"python.envFile": ".env"
ANSWER 4
Score 45
When I do > reload window that fixes it.
Reference: Python unresolved import issue #3840, dkavraal's comment
