Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 5: Real-time weather client
Lecture: Installing packages via pip (command line)

Login or purchase this course to watch this video and the rest of the course contents.
0:00 All right, let's work with pip a little bit.
0:02 We all use pip to install the external packages from PyPi
0:06 that we need to finish up our app.
0:08 First thing to do is ask which version of pip do you have,
0:11 you can type pip and something will happen,
0:14 but depending on the order on which you've installed Python
0:17 the way your path is setup you may end up with pip
0:20 that manages the packages from the Python 2 interpreter,
0:22 or you may end up with pip 3 which manages the packages for Python 3.
0:27 So you want to be very careful on ask which one do I have.
0:30 It turns out you can see here I have the one from 3.5,
0:34 before I installed 3.5 on OS X I believe I just typed pip I got pip version 2,
0:39 if you want to make sure you are working with pip 3 on OS X or Linux
0:43 you can just say pip 3, and that will always give you
0:46 either pip 3 or they will just fail,
0:48 similarly for Python 2 you can always say pip 2,
0:51 sometimes it's helpful to use the witch command to say which pip 3,
0:55 or maybe which pip and it will actually show you that works on Unix base systems,
1:01 on Windows the command is where pip, or where pip.exe
1:05 ok we saw that pip is actually the one we want,
1:07 I am just going to be super explicit and say pip 3 for this.
1:10 So the first thing to do is see what we have installed.
1:13 Maybe we already have Requests who knows.
1:15 So I can hit pip 3 list, and then this lists all of the packages
1:19 that are installed for my Python 3 interpreter.
1:22 And you can see Request does not appear in the list, so let's fix that,
1:26 notice it says we are using the old version of pip,
1:28 we'll fix that in a moment, so let's say pip 3 install Requests.
1:32 So if I hit go, you can see I have installed this before
1:37 so it actually grabs a cashed local version instead of redownloading it,
1:41 have they not installed it you would have seen download first,
1:44 the cool little progress bar and then it would have gone and done this.
1:48 While we are at it, let's talk about upgrading,
1:51 so pip itself is installed as a package,
1:53 it's very meta right, pip manages pip, and my pip is out of date,
1:58 chances are your pip is probably out of date too,
2:00 depending on how old your version of Python
2:03 it may be really out of date, so I can say pip install pip and do and upgrade,
2:08 chances are this is going to fail but let's try.
2:11 So it failed and why did it fail- well, permission error
2:16 cannot write to this library/frameworks/whatever,
2:21 that's a system level location,
2:23 so for this case we need to do sudo and enter a password,
2:29 again on Windows that would be running a command prompt as admin.
2:36 Excellent, so now we will get rid of that warning,
2:39 we'll be sure to be using the latest pip
2:41 the other package that we are going to need is Beautiful Soup.
2:45 We'll talk more about what Beautiful Soup is
2:46 but while we are here let's go ahead and install it,
2:48 so we'll say pip 3 install beautifulsoup now be careful,
2:53 there is beautifulsoup and a newer which is beautifulsoup4, this is one you want.
2:58 I already happen to have it installed,
3:01 so let's see if there is an upgrade for it.
3:04 Nope, it's already up to date, I have the latest version, that's excellent.
3:09 So we are ready to use both, Requests and Beautiful Soup 4.