Locked lesson.
About this lesson
To use Python properly, we create a virtual environment. In this lesson, we'll explain how to set one up.
Exercise files
Download this lesson’s related exercise files.
5 - Virtual Environment.docx57.2 KB 5 - Virtual Environment SOLUTION.docx
55.9 KB
Quick reference
Virtual Environment
To use Python properly, we create a virtual environment. Inside that environment, we'll install the 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 mywebsite using the command:
mkdir /c/python-excel
To move into that directory, use the command:
cd /c/python-excel
To create a virtual environment, use the command:
python -m venv virt
To turn on your virtual environment, use the command:
source virt/Scripts/activate
Hints & tips
- To create a virtutual environment: python -m venv virt
- To turn on a virtual environment: source virt/Scripts/activate
Lesson notes are only available for subscribers.