In this Python Programming Tutorial, we will be learning how to use Pipenv. Pipenv is a new package manager that combines pip and virtualenv into one easy-to-use tool. We will learn how to install pipenv, how to install new packages, how to manage our newly created environment for our project, and also look at some more advanced use cases. Let’s get started…

In this video, we will be looking at virtualenv and why you should be using virtual environments in Python. Virtual Environments in Python allow us to keep project-specific dependencies in a separate place than our global site-packages. This is extremely useful when you have different versions of packages for different projects.

Here’s a brief walkthrough of some of the code from the video:

Install virtualenv

pip install virtualenv

Create a location for your environments (Optional)

mkdir ~/Environments
cd ~/Environments

Create a new virtual environment (called venv for this example)

virtualenv venv

Activate your new virtual environment

source venv/bin/activate

At this point you can work from inside of your new virtual environment and know that you are keeping your project-specific packages and dependencies separate.

When you are finished, you can deactivate your virtual environment

deactivate

If you no longer need your environment and would like to delete it, you can just remove the directory