What terminal are you using? Please create a new powershell or cmd terminal. Also you should not open the folder of the virtual environment as a workspace. Below are the correct steps.
Create a new folder as a workspace, then open this folder in vscode
Create a new terminal using the following command to create a virtual environment
python -m venv .venv
Use the following command to activate the environment after creation
.venvscriptsactivate
Another way is to select the interpreter of the virtual environment in the Select Interpreter panel after creating the environment
And then the new terminal will automatically activate the environment
2
Answers
It looks like you are using Git Bash or a similar bash-like system for Windows. You need to run
Scripts/activate.sh
in this environment.For PowerShell, use
Scripts/activate.ps1
, and for cmd useScripts/activate.bat
.What terminal are you using? Please create a new powershell or cmd terminal. Also you should not open the folder of the virtual environment as a workspace. Below are the correct steps.
Create a new folder as a workspace, then open this folder in vscode
Create a new terminal using the following command to create a virtual environment
Use the following command to activate the environment after creation
Another way is to select the interpreter of the virtual environment in the Select Interpreter panel after creating the environment
And then the new terminal will automatically activate the environment
You can read creating-environments and venv.