Managing Python Dependencies Transcripts
Chapter: Isolating Dependencies With Virtual Environments
Lecture: Installing Packages Into a Virtual Environment
0:00 So next up, I am going to show you how to install packages into a virtual environment.
0:04 And for that, we're going to jump back into termianl session again.
0:07 So I am in the same project folder as before,
0:10 and I am inside an activated virtual environment.
0:13 So what I am going to do now is I am going to use the pip command
0:16 to install the popular Requests library.
0:23 Now, when I run the pip list command you can see here
0:26 that I successfully installed this Requests package,
0:29 and that the environment I am using here is pretty much empty besides that.
0:34 So there is some other stuff in here for example, the setup tools,
0:37 module or the pip module, but these are really just part of the core Python install.
0:42 So, this is nice, this is exactly what we wanted,
0:46 we're not cluttering up the global install here,
0:49 and just to make sure this actually works,
0:51 I am going to jump into a Python interpreter session
0:54 I am going to go ahead and I am going to import the Requests module
0:57 and I am going to fire off a simple http request
1:02 Alright, so this worked just fine,
1:05 so you just saw how to install a new module inside of the virtual environment,
1:08 it's really similar to the way you would install a package
1:11 inside the global environment, but the big difference this time is
1:14 that everything is kept nice and separate
1:17 and we're not cluttering up your global Python environment with this here.