Это может быть вызвано многими причинами, некоторые из них следующие.
1) Неверный путь к исполняемому файлу Python в коде VS
Solution: Configure the path to the python executable in the settings.json
Remember to re start VS Code once done.
2) Расположен пользовательский модульв нестандартном месте
Solution: Configure the settings.json to include this custom location for autocompletion to work
An exmample settings.json (for Linux) used to add a customModule from workspaceFolder
{
"python.pythonPath": "/usr/bin/python",
"python.autoComplete.extraPaths": [
"${workspaceFolder}/customModule"
]
}
Remember to re start VS Code once done.
3) VS код не был запущен из активной виртуальной среды
The path to the custom modules is set when a virtual environment is activated.
Solution: Launch VS Code from a Terminal/Command window with the correct virtual environment activated