Skip to content

Fail to use an environment variable in python.defaultInterpreterPath on Windows #10692

Closed
@wdscxsj

Description

@wdscxsj

Environment data

  • VS Code version: 1.43.1
  • Extension version (available under the Extensions sidebar): 2020.3.69010
  • OS and version: Windows 10 64-bit
  • Python version: 3.8.2

Expected behaviour

An environment variable in python.pythonPath is respected across all platforms.

Actual behaviour

Works on Linux (via Remote SSH), but fails on Windows.

Steps to reproduce:

  1. Specify "python.pythonPath": "{env:PYTHON_FOR_VSCODE}" in settings.json.
  2. Set a Windows environment variable PYTHON_FOR_VSCODE to point to an installed Python interpreter, in my case C:\Tools\Python3\python.exe.
  3. Restart VSCode, and open a hello.py.
  4. The yellow prompt "Select Python Interpreter" persists.
    • When it's clicked, a combobox comes to say current: {env:PYTHON_FOR_VSCODE}, and lists my locally installed Python interpreters, including C:\Tools\Python3\python.exe. Choosing it works fine, but defeats the purpose of using an environment variable.
    • In VSCode's Terminal, %PYTHON_FOR_VSCODE% --version runs as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous releaseverifiedVerification succeeded

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions