How to Set Up a Python Virtual Environment on Windows

Опубликовано: 27 Март 2026
на канале: Sensei
251
3

Learn how to set up a Python virtual environment on Windows in just a few simple steps! Virtual environments are crucial for isolating Python projects and managing dependencies. In this tutorial, i will guide you through the process of creating and activating a virtual environment using the built-in venv module. Whether you're a beginner or an experienced developer, mastering virtual environments will streamline your Python workflow and make project management a breeze. Watch now and level up your Python development skills!

Method 1:

steps:
1.Make sure you have installed python and pip
Python Installation Guide :    • How To Install Python on Windows 11 - 2022  
Pip Installation Guide :    • How to Install PIP on Windows 10/11 ? (pip...  

2.Create a directory and redirect into it
Ex:
mkdir test1
cd test1

3.Use this command to create an virtual env
Command: py -3 -m venv {environment name}

4.Use this command to activate it
Command: cd {environment name}/Scripts and then type Activate

Method 2:

steps:
1.Make sure you have installed python and pip
Python Installation Guide :    • How To Install Python on Windows 11 - 2022  
Pip Installation Guide :    • How to Install PIP on Windows 10/11 ? (pip...  

2.Create a directory and redirect into it
Ex:
mkdir test1
cd test1

3.Install Virtualenv
Command: pip install virtualenv

3.Use this command to create an virtual env
Command: virtualenv {environment name}

4.Use this command to activate it
Command: cd {environment name}/Scripts and then type Activate

Music:
"Sappheiros - Embrace" is under a Creative Commons license (CC BY 3.0)
Music promoted by BreakingCopyright: https://bit.ly/embrace-song

#python #virtualenv