How to install and use virtualenv?

What is virtual virtualenv?

A tool for creating isolated virtual python environments.

https://pypi.org/project/virtualenv/

How to install virtualenv?

To install latest virtualenv here I’ll use pip. Running the below command we can easily install virtualenv.

pip install virtualenv

How to use virtualenv?

After successful installation, we have to follow these steps to use it:

Step 1: Create a virtual environment for your python script by following command

virtualenv 'path-of-the-project-environment-directory'

virtualenv project_env

Above command will create a new directory named ‘project_env’. All the scripts or modules using in this project will stay here.

Step 2: Now we need to activate our new virtual environment

& e:/sitemap_automation/project_env/Scripts/Activate.ps1

By running above code we can activate our new virtual environment.

Step 3: There is no more step 3. From now you are using your new virtual environment.

Finally you can deactivate your virtual environment by simply enter a command ‘deactivate’

For more information you can visit https://pypi.org/project/virtualenv/

Leave a Comment