Managing Python Dependencies Transcripts
Chapter: Isolating Dependencies With Virtual Environments
Lecture: Installing Packages Into a Virtual Environment

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So next up, I am going to show you how to install packages into a virtual environment.
0:05 And for that, we're going to jump back into termianl session again. So I am in the same project folder as before,
0:11 and I am inside an activated virtual environment. So what I am going to do now is I am going to use the pip command
0:17 to install the popular Requests library. Now, when I run the pip list command you can see here that I successfully installed this Requests package,
0:30 and that the environment I am using here is pretty much empty besides that. So there is some other stuff in here for example, the setup tools,
0:38 module or the pip module, but these are really just part of the core Python install. So, this is nice, this is exactly what we wanted,
0:47 we're not cluttering up the global install here, and just to make sure this actually works, I am going to jump into a Python interpreter session
0:55 I am going to go ahead and I am going to import the Requests module and I am going to fire off a simple http request Alright, so this worked just fine,
1:06 so you just saw how to install a new module inside of the virtual environment, it's really similar to the way you would install a package
1:12 inside the global environment, but the big difference this time is that everything is kept nice and separate
1:18 and we're not cluttering up your global Python environment with this here.


Talk Python's Mastodon Michael Kennedy's Mastodon