How to Create Python Virtual Environment in Windows? Step by Step Instruction of creating Python virtual environment on Windows 10/11
A Python virtual environment is very useful to run many different projects depending on different versions of Python libraries. For example, in one project you can use one version of the Python library but in another project you can use different versions of Python libraries. The Python virtual environment makes project development and deployment much easier for the developers and system admin. In this tutorial we are going to create a Python virtual environment in Windows 10 operating system.
What is virtual environment in Python?
A Python virtual environment in a Python environment with Python Interpreter, scripts and dependent Python libraries. In one machine you can have any number of Python virtual environments, usually one environment with one Python project. You can have a project specific Python virtual environment to manage all dependencies for that project. Virtual environment helps developers in managing project specific dependencies and run the project using those dependencies.
We have recorded the Video Instruction of creating and using Python Virtual Environment on Windows 10/11. Here is the video:
Step by Step Instruction of creating Python Virtual Environment in Windows
Here is Step by Step Instruction of creating Python Virtual Environment in Windows:
Step 1: Install Python on Windows
First of all you should install Python on you Windows desktop if its already not installed. You can type following to see if Python is installed on your computer:
python --version
If Python is installed then it should show the Python version.
Step 2: Create directory to create Python Virtual Environment
You should create a new directory and open cmd and go to that directory.
Step 3: Create Python Virtual Environment
Use the following command to create Python Virtual Environment:
python -m venv env
Above command creates a Python environment with the name "env" and new directory gets created to host all python executables and other artifacts.
Step 4: Activate the Python Virtual Environment
To activate the Python Virtual Environment run the following command in the same directory:
env\Scripts\activate
Here is the screen shot of the above steps:

Step 5: Install Python requests library
Now you can install Python libraries in your Python virtual environment. Here is command to install Python requests library in your virtual environment:
pip install requests
Above command installs Python requests library.
Step 6: Deactivate Python Virtual Environment
You can deactivate Python Virtual Environment by running following command on the console:
deactivate
In this tutorial we have understood the Python virtual environment and also created the virtual environment.
Related Tutorials: