How to create isolated Python virtual environment?
Gulshan Saini
August 18, 2020
1 min

Python 3.3+ comes with the venv library, providing support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories.

Creating virtual environment

To create an isolated virtual environment for Python type python -m venv <name_of_virtual_env>

This will create a local_env/ directory, including your Python environment. Any Python libraries you install while your virtual environment is active will go into the local_env/lib/python3.8/site-packages directory.

Activate virtual environment

After creating the virtual environment, next step is to activate your virtual environment, which can be done as follows

The shell prompt will include the name of the active virtual environment enclosed in parentheses, as follows:

De-activate virtual environment

To de-activate virtual environment type deactivate command and press Enter key.


Previous Article
What is the max HTTP header size in NodeJS server?

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.
© 2020, All Rights Reserved.

Quick Links

Advertise with usContact Us

Social Media