Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 903 Bytes

chapter-12.1-virtual-environment-intro.md

File metadata and controls

34 lines (21 loc) · 903 Bytes

12.1. Introduction to Virtual environments

Let us consider that we have to work simultaneously on 2 different projects with different package dependencies as follows

Base Python

  • django==4.0.0

Project 1

  • django==2.2
  • pillow==7.0
  • numpy==1.0.0

Project 2

  • django==3.2.10
  • pillow==9.1.0
  • numpy==1.5.0

Suppose we have base python 3.9 installed and different requirements for different projects. Switching back and forth between the projects requires installing and uninstalling different packages which is impractical in daily use.

To avoid frequent installation and uninstalling of packages, we can use virtual environments.

A Virtual Environment is a tool that keeps dependencies required by different projects in separate places.

Followings are common virtual environments:

  • venv, virtualenv
  • pipenv
  • direnv
  • pyenv
  • conda