Python for the .NET developer Transcripts
Chapter: Package management and external libraries
Lecture: Concept: Installing Python packages
0:00 Let's quickly summarize installing requirements.
0:02 Now I have a quick little shortcut
0:03 that I'm using here to create a virtual environment.
0:06 The idea is you say python -m venv venv
0:10 and then you activate it
0:13 and the way that happens on Windows, POSIX system
0:16 or MAC OS, and Linux is slightly different
0:18 but I've shown you that a couple of times.
0:20 So we're going to create a virtual environment
0:21 and activate it.
0:22 And then maybe we'll have some kind of requirements.txt
0:25 or you can just individually install them.
0:27 So here you can see that we're looking
0:29 at the contents of our requirements.txt.
0:31 It has three requirements, httpx
0:33 bs4, and colorama. And then when we want to install them
0:36 we just say pip install all the requirements
0:38 in this file.
0:39 The way we do that is way say pip install -r
0:43 and then the filename.
0:44 This can be a full path, but because we're in this
0:46 working directory, we can just use
0:48 the requirements.txt file.
0:50 We also saw that PyCharm will manage these
0:52 and automatically suggest installing them
0:54 as soon as you type them into the requirements.txt file
0:58 if it's at the top level of the project.
1:00 If it's in some sub folder, PyCharm ignores it.
1:03 And you can see it downloads some of the files
1:05 it will use cached ones if you've downloaded
1:07 them before, and just installs them in all
1:10 of their dependencies, and your new virtual environment
1:12 is ready to start working with all these libraries.