DEV Community

Cover image for How to Install and Use Virtualenv on Linux
YogSec
YogSec

Posted on

How to Install and Use Virtualenv on Linux

Why Use Virtualenv?

When you're juggling multiple Python projects, you might need different versions of libraries for each. Installing everything globally can quickly become a mess. Virtual environments isolate your project’s dependencies, making development more manageable and cleaner.

Step 1: Install Virtualenv

sudo apt update
sudo apt install python3-virtualenv

Enter fullscreen mode Exit fullscreen mode

OR

pip3 install virtualenv

Enter fullscreen mode Exit fullscreen mode

Step 2: Create a Virtual Environment

virtualenv venv

Enter fullscreen mode Exit fullscreen mode

Step 3: Activate the Environment

source venv/bin/activate

Enter fullscreen mode Exit fullscreen mode

Top comments (0)