-
In VSCode open your command palette —
Ctrl+Shift+P
by default -
Look for
Python: Select Interpreter
-
In
Select Interpreter
chooseEnter interpreter path...
and thenFind...
-
Navigate to your
venv
folder — eg,~/pyenvs/myenv/
or\Users\Foo\Bar\PyEnvs\MyEnv\
-
In the virtual environment folder choose
<your-venv-name>/bin/python
or<your-venv-name>/bin/python3
The issue is that VSCode’s Python extension by default uses the main python
or python3
program while venv
effectively creates a “new” python
/python3
executable (that is kind of the point of venv
) so the extension does not have access to anything (available modules, namespaces, etc) that you have installed through a venv
since the venv
specific installations are not available to the main Python interpreter (again, this is by design—like how applications installed in a VM are not available to the host OS)