Skip to content
Advertisement

vscode python linux: how to automatically open terminal in right venv?

every time I open a vscode workspace I get a terminal the isn’t attached to the right venv, although I did put the right python path in ws.code-workspace.json:

{
    "folders": [
        {
            "path": "."
        }
    ],
    "settings": {
        "python.pythonPath": ".venv/bin/python3"
    }
}

is there a way to automatically get the terminal running in the right venv?

Advertisement

Answer

Your steps to detect the venv path are correct, but: The right answer is that currently the terminal isn’t capable to auto open with the right venv- only the second opened terminal will detect the venv and open it automatically.

UPDATE: there is a new flag that one can use: "python.terminal.activateEnvironment": true

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement