Virtual Environments With virtualenvwrapper for windows

Sachinjose
2 min readMar 19, 2021

If you are a python developer, you would have faced some situations where you spend hours installing the libraries you need, only to find you have broken some piece of code you have already written. Sometimes certain packages support only some specific version, which may conflict with your other codes.

The solution is to create a virtual environment where you can play around by keeping the packages detached from your code's rest. This post will help you in setting up a virtual environment. These instructions are for Windows.

Step 1: Install the python virtual environment package.

Let’s first install the python package required.

pip install virtualenvwrapper-win

Step 2: Creating an environment

Run the below command to create a new environment where env_name specifies the name of the environment you want to create.

mkvirtualenv env_name

Step 3: Activating the environment

To activate the environment, use the below command.

workon env_name

After running, make sure the environment name is mentioned before the path, as shown in the image below.

Step 4: Deactivating the environment

To exit from the environment, use the below command.

deactivate

Listing the environments created

To list all the environments installed, you can use,

lsvirtualenv

For creating virtual environments in an anaconda and use it inside jupyter, see here.

--

--