Isolating Dependencies With Virtual Environments
00:23 Next, you are going to learn how to create and activate a virtual environment on your system, after that, you’re going to learn how to install packages into a virtual environment; you’ll also learn how to deactivate virtual environments and how to completely delete them again.
00:49 So we just learned that Python has a powerful package management system. What do we need that isolation for? The thing is that by default, pip installs all packages in a single shared environment, which means that if you need different versions of Python packages, there are going to be version conflicts.
01:08 Here is an example. Imagine you are working on two projects. Project #1 needs a specific version of Django, let’s say version 1.8, and it also needs a specific version of the Requests library, let’s say version 2.0.
01:22 Now, the other project, Project #2, needs a completely different version of Django, and it also needs a different version of Requests. Now if all of your packages need to be installed into the same shared environment, there are going to be version conflicts between these packages.
01:52 So, maybe you’re working on another project that actually requires Python 3.6 to run. How do you resolve these version conflicts? Virtual environments are really helpful tool that can help you with this problem, so a virtual environment allows you to isolate all of your Python dependencies by project, and this works for packages and also for different versions of the Python interpreter.
Become a Member to join the conversation.