1 00:00:00,230 --> 00:00:03,810 Sometimes you're going to want to see which Python packages 2 00:00:03,810 --> 00:00:04,800 you have installed. 3 00:00:04,800 --> 00:00:07,000 So there's a few different ways of doing this. 4 00:00:07,000 --> 00:00:09,200 There's the hard way which you could try. 5 00:00:09,200 --> 00:00:12,300 You could try to import the package from your Python shell. 6 00:00:12,600 --> 00:00:17,510 So you could do something like this, 'from colorama import *', 7 00:00:17,900 --> 00:00:20,420 everything. Okay. No complaints. 8 00:00:20,420 --> 00:00:21,600 But what if I did 'from 9 00:00:21,600 --> 00:00:27,100 packagethatclearlydoesnotexistonmycomputer 10 00:00:27,100 --> 00:00:30,200 import', anythingelse, 11 00:00:30,220 --> 00:00:34,950 a 'thing'. We're going to see, 'ModuleNotFoundError', and that 12 00:00:34,950 --> 00:00:37,400 this module, this package does not exist. 13 00:00:37,400 --> 00:00:38,840 So you could always try that. 14 00:00:38,840 --> 00:00:42,700 But you're really, you're guessing at that point, and that's no good. 15 00:00:42,700 --> 00:00:46,400 Now, a better way to live your life is to simply type 'pip 16 00:00:46,400 --> 00:00:50,150 freeze', and this actually isn't going to freeze anything. 17 00:00:50,540 --> 00:00:53,180 I'm sure there's a reason why they call it 'freeze', but it 18 00:00:53,190 --> 00:00:54,290 doesn't actually do anything. 19 00:00:54,300 --> 00:00:57,400 It just sort of takes a snapshot of all of your packages 20 00:00:57,400 --> 00:00:58,800 that are installed, and gives you a list. 21 00:00:58,830 --> 00:01:03,330 So when I hit 'Enter', you'll see a long list of all these different 22 00:01:03,330 --> 00:01:04,300 packages that I have. 23 00:01:04,300 --> 00:01:08,700 And I use pretty much all of these on a day to day basis, 24 00:01:08,700 --> 00:01:09,900 so I keep them. 25 00:01:09,900 --> 00:01:13,900 And if you're on a Unix like system, I'll show you a cooler shortcut here. 26 00:01:13,900 --> 00:01:15,930 This may or may not work on Windows, though. 27 00:01:15,930 --> 00:01:19,900 You can do 'pip freeze | grep', 28 00:01:21,300 --> 00:01:25,800 and then let's look for "colorama". "colorama", or just "color" even. 29 00:01:27,400 --> 00:01:28,800 So, we've got a package, 'colorama', 30 00:01:28,800 --> 00:01:30,800 the version is 0.4.3. 31 00:01:30,860 --> 00:01:35,240 Now, going back to this big list here, if you do a 'pip freeze' 32 00:01:35,250 --> 00:01:39,570 on your computer, and you don't necessarily recognize everything 33 00:01:39,570 --> 00:01:42,300 that's in there, that's actually okay. 34 00:01:42,320 --> 00:01:45,870 Chances are it was a dependency that was installed. 35 00:01:45,880 --> 00:01:48,450 So, like when I installed Django a couple of lessons ago, 36 00:01:48,450 --> 00:01:50,600 it comes with a few requirements. 37 00:01:50,670 --> 00:01:55,030 So let's do 'pip show Django', and it is 'Required-by: wagtail'. 38 00:01:55,030 --> 00:01:58,100 So if I did 'pip install wagtail' it would get Django for me, 39 00:01:58,100 --> 00:02:02,600 django-trebeard, django-taggit, and django-debug-toolbar. 40 00:02:02,600 --> 00:02:05,500 All of these packages require Django. 41 00:02:05,500 --> 00:02:08,900 So if I installed 'django-debug-toolbar, it might actually 42 00:02:08,900 --> 00:02:10,600 install Django for me as well. 43 00:02:10,630 --> 00:02:11,770 Let's do another one. 44 00:02:11,780 --> 00:02:13,270 'pip show requests'. 45 00:02:13,280 --> 00:02:17,040 This is a very popular package, and this one is required 46 00:02:17,040 --> 00:02:21,800 by requests-toolbelt, poetry, twine, PyVimeo, 47 00:02:21,880 --> 00:02:26,400 so the Python Vimeo API, which I've recently been using, 48 00:02:26,400 --> 00:02:28,300 and proxy-requests. 49 00:02:28,320 --> 00:02:33,490 And so if I installed PyVimeo, so I did 'pip install PyVimeo', 50 00:02:33,800 --> 00:02:36,800 it would also go ahead and get 'requests' for me as well. 51 00:02:36,820 --> 00:02:40,210 And that's why you might see a package in there that you 52 00:02:40,450 --> 00:02:45,020 don't necessarily know how it got in there. It's called a dependency, 53 00:02:45,020 --> 00:02:46,500 and so that's totally normal. 54 00:02:46,500 --> 00:02:47,900 [no audio]