Visual Studio Code does not detect Virtual Environments

  1. In VSCode open your command palette — Ctrl+Shift+P by default

  2. Look for Python: Select Interpreter

  3. In Select Interpreter choose Enter interpreter path... and then Find...

  4. Navigate to your venv folder — eg, ~/pyenvs/myenv/ or \Users\Foo\Bar\PyEnvs\MyEnv\

  5. 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)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)