Python for Absolute Beginners Transcripts
Chapter: Using external Python packages
Lecture: Concept: External packages workflow
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's take just a moment and review how we're using our external libraries or external packages. We have a requirements.txt where in our program
0:09 we express this program is going to need these external packages or it's going to crash or not run or it just won't function.
0:16 So we put that in the requirements.txt somewhere and then before we install the packages you want to make sure you have
0:22 an isolated virtual environment. So you do that one of two ways depending on the operating system you're on.
0:27 A macOS and Linux you have this Python3 -m venv that's the module, the command and then venv is the directory
0:35 you can change that to be whatever you want. Then you have to say . foldername/bin/activate. On a Windows very similar
0:41 but it's no dot, and then venv\scripts\activate. Once either of those are done your prompt should change to have this little venv
0:50 or maybe in the future the folder name at the top there. And then you just pip install the requirements by saying -r and then the requirements file.
0:58 It doesn't have to be requirements.txt but it probably should because that's what the tools look for. Then you can just start using your library
1:07 and import colorama, work with its elements like this four class or four enumeration. Here we want to say hi, with color. Make that green? Easy now.