Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 5: Real-time weather client
Lecture: Concept: Virtual Environments
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Before we completely step away from our weather app
0:03
let's talk about the final concept virtual environments
0:06
recall, virtual environments allow you to create isolated
0:10
dedicated environments for a particular application
0:13
in there you have a copy of the Python runtime
0:16
and you have initially, basically no packages
0:20
but you can use pip to install those packages
0:23
and they won't conflict or battle with any of the machine wide ones
0:28
you just have only what you need in this nice clean environment.
0:31
It helps you understand how you deploy to production
0:34
it helps you understand what requirements you want to tell other users to have
0:38
they are going to run your scripts on their machines
0:41
now just creating the virtual environment is not enough
0:44
remember, you have to activate it so you change into the environment folder
0:48
and into bin, and you say .space activate on OS X or Linux
0:52
and on Windows you just say activate
0:55
I believe it might be a batch file.
0:57
But, you call activate and then your command prompt changes
0:59
your path changes so that all the Python tools like Python itself
1:03
pip and so on now run exclusively out of that environment.