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
0:01
how we're using our external libraries or external packages.
0:05
We have a requirements.txt where in our program
0:08
we express this program is going to need
0:10
these external packages
0:12
or it's going to crash or not run or it just won't function.
0:15
So we put that in the requirements.txt somewhere
0:17
and then before we install the packages
0:20
you want to make sure you have
0:21
an isolated virtual environment.
0:23
So you do that one of two ways
0:25
depending on the operating system you're on.
0:26
A macOS and Linux you have this Python3 -m venv
0:30
that's the module, the command
0:32
and then venv is the directory
0:34
you can change that to be whatever you want.
0:35
Then you have to say . foldername/bin/activate.
0:38
On a Windows very similar
0:40
but it's no dot, and then venv\scripts\activate.
0:45
Once either of those are done
0:47
your prompt should change to have this little venv
0:49
or maybe in the future the folder name at the top there.
0:52
And then you just pip install the requirements
0:55
by saying -r and then the requirements file.
0:57
It doesn't have to be requirements.txt
1:00
but it probably should
1:01
because that's what the tools look for.
1:04
Then you can just start using your library
1:06
and import colorama, work with its elements
1:09
like this four class or four enumeration.
1:11
Here we want to say hi, with color.
1:13
Make that green? Easy now.