Virtual Environment in Python.
A virtual environment in Python is a self contained directory that contains its own Python Interpreter and set of libraries.
Used to isolate Python projects and their dependencies which ensure that each and every project has its own clean and separate environment.
Helps to prevent conflicts between different projects dependencies.
Creation of virtual environment is easy. You just need to have Python installed in your system.
python -m venv name_of_virtual_environment
Get Anirudh Suri’s stories in your inbox
Join Medium for free to get updates from this writer.
venv is the built in module.
Activation of virtual environment.
name_of_virtual_environment\Scripts\activate (on Windows)
source name_of_virtual_environment/bin/activate (on linux or mac)
After creating the virtual environment, you can install packages specific to your project using pip.
pip install your_package_name.
The package that you installed in the virtual environment will be separted from the global Python installation.
This is the beauty of this virtual environment.





