Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, we’ll introduce the workshop and dive straight into what a Python virtual environment is, and why you might want to use it.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hi, I'm Rachel,
a Python teacher here at Treehouse.
0:09
If you're wanting to build powerful
Python apps, you'll likely use
0:14
third-party libraries, and therefore
need a Python virtual environment.
0:18
In this workshop, we'll first explore
what virtual environments are and
0:23
why they're so important.
0:28
Then, you'll learn to use the venv tool
to manage these virtual environments and
0:30
install libraries
specific to your project.
0:36
Finally, we'll find out how to
replicate a virtual environment so
0:39
your fellow students or future clients
can run your project on their machines.
0:44
You'll complete this workshop with
the foundational understanding of Python
0:49
virtual environments, and how to use
them to manage multiple projects and
0:54
their dependencies.
0:58
Let's get started.
1:00
A Python
virtual environment is a directory
1:02
that sits inside your project folder.
1:05
It contains
all the necessary files needed to run
1:08
a Python project
that uses third party libraries.
1:11
You can think of this as a little computer
inside your computer
1:15
that is dedicated
to running a specific Python project.
1:20
Take this project
an environment, for example.
1:24
The project uses SQL Alchemy version
1:28
2.0 and FLASK version 2.2.
1:31
Both of these libraries are installed
in this virtual environment,
1:35
allowing this project to use both.
1:39
Now let's start
1:43
another project
that uses SQL Alchemy version
1:44
1.4 and requests version 2.28.
1:47
It wouldn't make sense to run this project
in our first virtual environment
1:52
because our new project uses
a different version of SQL Alchemy
1:57
and needs access to another library.
2:01
In this case,
we'll create a new virtual environment
2:04
for our new project
and install those specific libraries.
2:08
In short, virtual environments
allow developers to work with libraries
2:13
without affecting the system wide Python
2:18
installation or other Python projects.
2:20
Now that you know what
Python virtual environments
2:24
are, let's dive
into creating and using one.
2:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up