Locked lesson.
About this lesson
A virtual environment is a helpful tool that allows us to install programs and try out code without affecting the rest of our computer. In this video, you'll learn how to set up your own virtual environment.
Exercise files
Download this lesson’s related exercise files.
Setting up a Virtual Environment.docx57.2 KB Setting up a Virtual Environment - Solution.docx
56 KB
Quick reference
Setting up a Virtual Environment
To use Jupyter Notebooks, we create a virtual environment. Inside that environment, we'll install Jupyter Notebooks and other tools that we'll need.
When to use
Set up a virtual environment once per project. Then, every time you work on your project, make sure to turn on your virtual environment.
Instructions
First, create a new directory called data using the command:
mkdir /c/data
To move into that directory, use the command:
cd /c/data
To create a virtual environment, use the command:
python -m venv virtual
To turn on your virtual environment, use the command:
source virtual/Scripts/activate
Hints & tips
- To create a virtutual environment: python -m venv virtual
- To turn on a virtual environment: source virtual/Scripts/activate
Lesson notes are only available for subscribers.