简体   繁体   中英

I activate venv in vscode but it doesnt appear in terminal

在此处输入图像描述

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

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 .

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

    在此处输入图像描述

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

    在此处输入图像描述

You can read creating-environments and venv .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM