How to Make a Python 3 Virtualenv

Working with Python, you might have come across the need for segregating project environments. A useful tool for this purpose is the Virtualenv. In this tutorial, we shall guide you on how to make a Python 3 Virtualenv.

What is Virtualenv?

Virtualenv is a Python library used to create isolated Python environments. It keeps the dependencies required by different projects in separate places by creating isolated Python virtual environments for them. So, every project can have its own dependencies, irrespective of what dependencies every other project has.

Step 1: Install Virtualenv

If Virtualenv is not installed, install it using pip:

Step 2: Test your Installation

Once installed, you can check your installation with the following:

Step 3: Create a Python 3 Virtual Environment

Now let’s create a new virtual environment using Python 3:

Step 4: Activate the Virtual Environment

After creating a Virtual Environment, you can activate it using:

Windows:

Linux/Mac:

Complete Code

Here is the complete implementation for creating and activating a Python 3 Virtualenv.

Conclusion

The creation of a virtual environment can streamline your work and keep the dependencies of different projects separate, ensuring no conflicts occur. You can read more on the subject to further refine your use of Python 3 virtual environments.