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:
pip install virtualenv
Create a location for your environments (Optional)
mkdir ~/Environments cd ~/Environments
Create a new virtual environment (called venv for this example)
Activate your new virtual environment
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
If you no longer need your environment and would like to delete it, you can just remove the directory
rm -rf venv