New Skills

New Training: Python Virtual Environments

by Team Nuggets
New Training: Python Variables and Data Types picture: A
Published on February 19, 2021

In this 6-video skill, CBT Nuggets trainer Ben Finkel teaches you how to use various techniques and tools in order to isolate your development spaces in Python, including venv and virtualenv. Watch this new Cisco training.

Watch the full course: Cisco CCNP Automating Cisco Enterprise Solutions

This training includes:

  • 6 videos

  • 31 minutes of training

You’ll learn these topics in this skill:

  • Intro to Python Virtual Environments

  • Installing Python Dependencies

  • Using venv to Create Python Virtual Environments

  • Using virtualenv to Create a Python Virtual Environment

  • Isolating with Virtual Machines and Containers

  • Python Virtual Environments Summary

Overview of Python Virtual Environments

Since version 3.3, Python has had the ability to create virtual environments. Simply put, a Python virtual environment is a separate, self-contained "sub" environment capable of having different Python binaries and site packages from the host system or O/S.

Virtual environments provide an essential abstraction layer for dependencies in Python. As in most modern programming languages, abstraction is a key concept that ensures maintainability and testability by having smaller, self-contained building blocks that can be used to build a bigger application. Python virtual environments essentially enable that same concept. Each virtual environment can host different Python binaries and site packages, thereby eliminating the risks involved with modifying the host environment.

By default all Python projects on a computer will use the system host binaries and packages (standard library packages), virtual environments allow for separation of site packages (third party libraries) to allow projects with different Python versions to co-exist. Segregating projects this way ensures greater stability and promotes re-use.

Recommended Articles