I have django project folder with venv environment. when opening vscode it has terminal opened in vscode.
Is there a way that I don't have to venv/bin/activate all the time when opening the project folder?
Edit (credit to @XJOJIX) from the comment in this answer. This will active the virtual environment without having to close or open terminals. A Python file still needs to be selected to load the Python extension.
Add this parameter in VS Code to "launch.json" or ".code-workspace"
"settings": {
"python.terminal.activateEnvInCurrentTerminal": true
}
Previous Answer:
To have a VS Code terminal automatically activate a virtual environment when first launching VS Code:
The trick is to open the terminal only after the Python extension has loaded.
If the directory of the terminal contains a virtual environment, VS Code will also automatically activate a virtual environment if a new terminal is opened. As before, a Python file must be selected and the Python extension must be fully loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With