create virtual environment python windows 10 code example

Example 1: create venv in windows

# windows
python -m venv <venv-name>
# To activate
#C:\Users\..\<venv-name>
.\Scripts\activate.bat

Example 2: how to activate a venv in windows

\env\Scripts\activate.bat

Example 3: activate virtualenv windows

venv\Scripts\activate

Example 4: venv activate windows

#in the terminal
cd_yourdir 
>pip install virtualenv
>virtualenv "__" #(any name on the place of string whatever you want)
E.G.
> virtualenv venv
>D:Projectdir/venv/scripts/activate.bat
  DONE !!!
# It will look like this now

(venv) D:/projectdir>

Example 5: create environment python windows 10

python3 -m venv venv

Example 6: how to create virtualenv in specific directory in windows

Create a Virtual Python Environment
cd to your project directory and run virtualenv to create the new virtual environment.

The following commands will create a new virtual environment under my-project/my-venv.

cd my-project
virtualenv --python C:\Path\To\Python\python.exe venv