Home > database >  I activate venv in vscode but it doesnt appear in terminal
I activate venv in vscode but it doesnt appear in terminal

Time:11-24

enter image description here

I have no idea whats going on but I activated venv by using Scripts/activate and it doesnt working yet, the (venv) isnt appearing

please someone could help me? I tried everything I could find lol

CodePudding user response:

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 use Scripts/activate.bat.

CodePudding user response:

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.

  1. Create a new folder as a workspace, then open this folder in vscode

  2. Create a new terminal using the following command to create a virtual environment

    python -m venv .venv
    
  3. Use the following command to activate the environment after creation

    .venv\scripts\activate
    
  4. Another way is to select the interpreter of the virtual environment in the Select Interpreter panel after creating the environment

    enter image description here

  5. And then the new terminal will automatically activate the environment

    enter image description here

You can read creating-environments and venv.

  • Related