AI for Everyone LESSON 2: Running Two Different Versions of Python on the Same Computer

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is paul mcquarter from toptechboy.com and we're here today with episode number two in our incredible new tutorial series where you're gonna learn artificial intelligence or you're gonna die trying i'm going to need you to pour yourself a nice full cup of iced coffee that would be straight up black coffee poured over ice no sugar no sweeteners none needed now as you are getting out your coffee as always i want to give a shout out to you guys who are helping me out over at patreon it is your encouragement and your support that keeps this great content coming you guys that are not helping out yet look down in the description there is a link over to my patreon account think about hopping on over there and hooking a brother up but enough of this shameless self-promotion let's jump in and talk about what we're going to learn today this class this series of lessons is all about learning artificial intelligence but we have to start by laying some foundation work laying down some of the fundamentals guys i'm promising you that i'm going to get to the fun stuff and the cool stuff as quickly as we possibly can but there are just some things that you've got to understand up front or you're going to struggle all the way through this class now the thing that we're going to learn today is we're going to learn how to run multiple versions of python on one computer because some of the things that we're going to be doing we'll be needing to do on one version of python and other things that we're going to be doing we're going to be needing to do on other versions of python and this is something that can be really confusing and it's something you're just going to struggle with for the rest of the class if we don't figure it out plus it's something that's just very useful in general to learn so this week we're going to learn how to run multiple versions of python uh on the same computer and then in the next lesson what i'm going to do is show you how to enhance that then by using virtual environments but we're going to start just by flat out running two different versions of python and then in the next lesson i'll explain to you about virtual environments and virtual environments is probably something you see a lot about but maybe never really had anyone take you through it step by step so that you can understand it and you can use it it's a very powerful tool and then again as quickly as possible we'll get to the fun stuff we'll get to the cool stuff we'll get to the g whiz stuff okay are you ready to rumble we're gonna get going here and what i will do is i will switch over here to a uh a browser and what i will need you to do is call up your browser and then i like to search using the most excellent duckduckgo search engine and what we're going to search on is we're going to search on python download all right and guys like i say even if you already have a version of python on your computer you really need to follow through this lesson with me so we end up with our systems configured the same so that the things that i do on the screen will work with you when you try them at home if we're running completely different systems who knows what's going to happen so we're going to search on python download and then it comes up over here to download python oh it wasn't okay that's an ad was the top result and then here download python from python.org the url is actually python.org downloads so we will click on that all right now you notice if i clicked on this little yellow box here it would give me the latest and greatest version of python the problem is when you watch this video it might not be the same number here right so if you did exactly what i did here and just clicked on that then you might not end up with python 3 3.9.6 so we're going to be operating on python 3.9.6 and so if your little box there doesn't say that what you can do is you can scroll down and you can see ah look we've got three point ah let's see where is it okay what we're going to do is we are going to come to windows okay so we clicked on windows let me do that to make sure you see it okay we're not going to click there we're going to click on windows all right and then we're going to come and then it says python 3.9 or even if we scroll down a little bit it says windows embedded package no i want the windows installer 64-bit the windows installer 64-bit under python 3.9.6 so we're going to click on that and then if we look down here we get the happy little uh download icon and my goodness mine downloaded very very fast which is good and so you can see down here we've got the little icon the little happy exe that makes it so easy to do installation so i'm going to go ahead and click on that if you're on a different browser and don't see it here you need to probably go look in your downloads folder and it will be there but i'm going to click right there and hopefully something will happen and we have got boom we've got the little installer pop up here now guys this is really important you want to install the launcher for all users yes check box that yes and very very important you want to add python 3.9 to pass so both of those little boxes need to be checked and now we are going to do an install now so i will do i will do an install now and now the happy little green bar is going across and we will have this installed in no time these things nowadays are really pretty easy to install back in the day man it was a it was a boogaroo to try to get python running on windows but now it's gotten down to where it's really easy to install it is installed so we're going to close it okay now what we're going to do is we're going to just check and make sure that we've got it and so let me turn that label off and down here what i want you to search on is power for your windows powershell so i just type power and i'm going to open up the most excellent powershell and then i'm just going to type python okay and boom python we're now in a python interpreter so i could just say print and i could say print hello world and then i could close that off and then i could hit enter and boom hello world wrote our first little line of python code here in this series of lessons how do you get out of the python interpreter just quit and then open and close parentheses and this is kind of new some of the earlier versions you had like control d control z control c and then you're sitting there trying to do that and it doesn't work for the most recent version of python okay another thing that makes me happy if i type python what you will notice is it tells me that i am on python 3.9.6 which is just what i just installed and so we're happy if yours didn't do that don't fear because maybe you already had a python on your system maybe you didn't get the python you wanted that's the whole point of this lesson we're going to learn how to deal with that okay so i'm just going to go ahead no i'm not going to quit i'm just going to show you like if i tried to import a library that we have not installed i'm going to say import serial which we have not installed it says it is not found so no module named serial and so you can't and you can't load that library so i'm going to quit out of here and then we're going to play with pip a little bit just to make sure that we're able to install packages in our python 3.9.6 and so to make sure that we can install something pip is a program that allows you to install libraries into python it comes with the modern version threes of python will have pip with it and it makes management of packages very very easy so what i can do if i want to install a library i just say pip and then i say install and then what do i want to install pi serial p y s e r i a l and then i click enter and it's going away looking and it looks like that it has found something and it looks like that it says successfully installed pi cereal okay so that's good news and let me bring this up a little bit and then i will bring my title back just because i like people who might jump into the middle know what we are talking about a little windows management here okay so now let's go back to python we are still on python 3.9.6 which is where we wanted to do but now if i say import serial okay look at that it took the serial so it did it without an error so we were able when we did pip install it actually installed it and it installed it on this version of python so that is most excellent i'm going to quit and then i'm going to put us back where we started by just saying pip uninstall and then what do i want to install pi serial so i'm going to take that back out are you sure you want to proceed yes okay so boom we're right back to where we started all right now what was this lesson going to be about this lesson was going to be about running multiple versions of python so we are going to come back to our most excellent browser and we're going to come back here to our python releases for windows and what i will want to install is i will want to install python 3.7 okay i am going to install python 3.7 and if you will give me just a second here okay i'm going to install python 3.7.9 you probably noticed i lost my little note so it took me a second to find the 3.7.9 i write these things down to make sure that we are doing the right thing and so i come down here and i am looking for a python 3.7.10 3.7 i'm looking for a 3.7.9 there it is python 3.7.9 and again i want to install the uh i have the executable installer but what i want is i want the 64 okay i want the 64 because i have a 64-bit machine i have a 64-bit machine and i want the executable installer that gives you the exe that makes it so easy to install so we are going to click on this and we're getting the download started and man i've got a blazing internet today i've got a blazingly fast internet and i have downloaded already python 3.7.9 normally i would have a sip of coffee while i'm waiting to download but here i'm just going to pause and enjoy a most excellent coffee guys leave me a comment down below have you guys adapted to iced coffee have you have you even tried it okay have you even tried it at least for me try the coffee okay now we're going to click on this executable python 3.7.9 and we're hoping there we go boom now you notice it's not giving me the option to install launcher for all users because it sees that launcher was already installed so now i'm just going to say add python to 3.7 add python 3.7 to path that's very important to have that selected and we're now going to do the install now and we've got the happy little green bar running across there that always makes us feel good that things are going along it's not crashing or hanging moving right along there [Music] and we're getting so close so close so close and it is done okay so we're going to close out of that and we're going to come back to our friend who who is your friend your friend is the power shell okay now we're going to type in python and we get python 3.7 okay which was the last one we installed okay now this is the question what if we wanted to run python 3.9.6 if i just type in python i get unfortunately if i just type in python i get 3.7.9 and this is kind of like where the problem is now i'm going to show you two different ways to handle this and so if the first way that i show you isn't maybe a way you know to do it don't yell at me i'm going to get to the two easy ways to do it but i want to show you the first way because it really involves us understanding things better and so i'm going to quit out of this okay i'm going to quit out of this and then i'm going to close the power shell i'm actually going to kill the power shell don't just minimize it kill it okay and then i'm going to come down here to the little search bar and i need to turn that off again the little search bar and i'm going to type in env okay and then it says edit the system environment variables so e in v as in environment system environment okay and then i get this little box up here and guys i am really sorry that i can't very easily make this bigger okay there doesn't seem to be an easy way to make this bigger but i'll go slow so what i need you to do is you look down here and what you can see is environmental variables this little box you're going to click on that and then you come up and you can see that there's different environment or environmental variables in this top box you want to click on path and you want to say edit okay and then these are those paths that we added at least the top four are the paths that we added when we did the uh when we did the python install now you can see i've got some extra ones here because i'd kind of played around with this before you know before going live with it but what can you see what is the first path the first path up here is the python 37 scripts and python 37 and so the way that these environmental variables work is if i type in python it looks in these paths and so it's going to look in the 30s python 37 scripts and then it's going to look in python 37 and when it looks in the python37 folder it finds python 3.7 and boom it runs that one now if you look right after that i've got python39 scripts and then python39 which is python 3.9 but it doesn't get there because all it does is it finds the first one and it runs with it so there is a python in the python 37 folder it is python 3.7 and that's the one that it runs all right so if i wanted to run python 3.9 what would i do i would need to make this go first and the way i make that go first is i move it up and move it up and i move the scripts up and then i'm going to move the 39 up okay move up move up oops you can't see because of my head you see that move up button okay and so now i've got python 39 has python 3.9 python 39 scripts and then python 37 scripts and python 37. now it doesn't matter if you do 39 or 39 scripts first it's just you've got to have the 39s before the 37s and now i'm going to say okay now it's very important you have to okay all the way out of this all the way out if you leave these open and don't okay out of them or if you left your power shell open and just went back to your powershell it's not going to see those changes so if you see something strange happened it is because you didn't okay all the way out of those dialog boxes and you didn't restart your powershell so let's try this now so we are going to say power uh and then we're going to open the powershell and now if i say python boom giddyup look at that python 3.9.6 why because it was the first one in the path now i'm going to say quit okay and now i'm going to kill the powershell and we are going to go back and fix it the way it was and so we're going to go environment again and then we are going to go to environmental variables and then we are going to go to the path and we're going to edit and then what i you can make these bigger too these windows will actually get where you can see the whole thing and now what i'm going to do is i'm going to move the 37 i'm going to move up move up and then the 37 i'm going to move up and move up so now when it loads these things it's going to look in the python 37 folders first i know there's a different way to do it but i want you to understand how paths work in windows so that when you run into this you know what it is actually doing so now i'm going to say okay okay and okay thrice okays thrice okays all right so now we will go back to the most excellent powershell and now what do you expect is going to happen when i say python we are going to get 3.7.9 okay that is what we expect all right so now you can see that that is how we can do it by moving the path around you know you can also run python by just typing pi and when i type pi unexpected result look at that when i type pi instead of python it runs 3.9.6 not because pi is tied to 3.9.6 but because pi launches the python launcher which automatically looks at all your pythons and gives you the most recent one okay and so now the way we have it configured i can just say python and it will go to 3.7.9 or i could type pi and it goes to 3.9.6 kind of cool huh you see how we're kind of getting control of this thing i always felt like python was in control but today we're the boss okay and i'm teaching you how to be the boss all right so we're going to quit and now i want to show you though that really you can launch things either i would do it one of two ways i would either always use python and then just adjust your you know which path is on the top of your environmental list of paths or i would always use pi now this is how you can always just do it by always using pi i can type pi and then dash and then i can say i want pi 3.7 and then boom python 3.7 i could quit or i could say pie and you guys are i'm running off the screen i hope you saw that last one okay and i get i can say pi and i could do dash 3.9 and then i get python 3.9 right that's pretty neat isn't it that is pretty neat okay so now let's see if there's any other things that i should do there no okay so you can use pi by dash and then which version you want 3.7 3.9 or 3.9 or 3.7 or if you just put pi it'll give you the most recent one or you can use python and you can put the pass in the right order so you see here is how you get control of which python you're running now do you remember how we did that and let me just look here let's see if i say python okay the 3.7.9 is on the top okay now this is the question what if i say pip in pi cereal again okay the question is where is it going to install it oh pip i'm sorry pip install my mistake pip install pi serial all right it's going to go out and get it and it is finding it and downloading it and it says it successfully installed it okay but now the real question is where did it put it okay so if i say python let's say if i say pi 3.9 or dash 3.9 okay and then i say import serial i get an error okay so it didn't put it in 3.9.6 if i say pi minus 3.7 and then i say import serial it liked it okay so where did it put it it put it in the python that is first in the path so if you just use pi if you use the little shortcut pi you know you can run whatever python you want but then when you run pip to install something it's going to install it in the python version that is the top one in the path okay do you see how this could get confusing but i'm showing you exactly how this works okay now i'm going to quit and now let's uninstall it so i'll say pip uninstall pi serial okay yes i want to uninstall it all right so now let's just check it i'll say pi 3.7 and then pi dash 3.7 okay now m port serial and it's not there as we expect okay so now this is a way that you can control where you install it if i just put pip it goes to whatever the top path is in python whichever version that is got it this is now there's a way you can do it where you don't have to go switch that around to get the right pip that you want you can do it this way i can say pip 3.9 and then install pi serial like that okay and it says successfully installed so now i will go pi minus 3.9 and i'll look there and i'll say import serial and boom it's there okay so you see i can run the python i won't want and when i do pip i can direct that installation to the version the vision of python that i want yes i can put it in the version that i want who's in control i'm in control all right and then just for good measure i can come in and i can say uh i can say python minus 3.7 and then i can say import serial and you can see that it's not there okay and so now i'm going to do a pip and then which was it it was pip 3.9 and then i'm going to do the un install and i'm going to uninstall pi serial so i get things back to the where it was and spelling is kind of important and so uni unistall uninstall serial okay yes i want to install it and boom okay so you see we can run the version of python that we want and we can control the version of pip that we want and so that is pretty darn good and pretty darn important and so we've kind of got complete control here of what we're doing now why are we needing to do this because i've got one series of lessons that is using python and visual python v python for doing 3d animations and 3d graphics and then we've got another series of lessons where we're doing artificial intelligence and those lessons are going to be operating on different versions of python so you need to be able to install a new version of python and keeping the old one and you need to control which version of python you are running and so i've kind of showed you how to how to do that here and then like on one version you're going to want to install visual python and then on another version you're going to want to install some other inference libraries and so forth and so that is what you got to understand because when i go through this in the lessons i want you to understand what i'm doing and not just type in things that i'm typing in without really understanding how it works okay promise you we're going to try to get to the fun stuff as quick as we can okay so what is your homework your homework is to install the latest version of python 3.6 3.7 you should already have it latest version of 3.8 and the latest version of 3.9 you're going to have four versions of python and then verify that you can pip install into each one of those using the techniques that i've shown you here and that you can start it and you can quit it and you can print hello world and you can verify that you put in pie cereal or remove pie cereal for those four now you really need to do that now what i like to always do you guys have taken my other lessons know that i like to put a little secret word in here so i gave you a homework when you do the homework type down in the comments i am legend i am legend if you successfully completed the homework if you messed up and couldn't get it to work you type in i folded up like a cheap walmart lawn chair so are you legend or did you fold up like a cheap lawn chair you need to do the homework okay every week i'm going to give you homework also i give a secret word at the end of the lessons to see if you in fact have watched all the way to the end now this secret word has to do with a little episode i had last night okay so last night i go to bed as i normally do and i'm kind of going off to sleep and out there in the little happy dream land and all of a sudden i hear a ruckus a ruckus outside my window and i didn't know what to do i thought well i'm just going to ignore it because you know i didn't know what to do but it was quite a commotion outside my window and then this morning when i got up and i talked to the guard on the compound and i asked him what that commotion was he showed me this picture yes we had a black mamba the dreaded black mamba outside by window and this was a huge one okay guard's name is pius pius solved my problem for me i'll just leave it at that he solved my problem for me but this was a massive black mamba now the thing is i don't know a black mamba like you think of a king cobra a black mamba is more dangerous than a king cobra and if you get bit by a black mamba it's like you have 30 minutes and then you die now if you get anti-venom it can save you but i am three and a half hours away from the nearest place that has anti-venom so it's like 30 minutes you die and three and a half hours away now if you look on the internet and it says what do i do if i'm bit by a black mamba it says number one stay calm how are you gonna stay calm if you get bit by a black mamba how are you gonna stay calm i'm not gonna be calm then the second thing it says to do is try to safely put the snake somewhere without harming it if i just got bit by a black mamba the last thing i'm gonna be worried about is safely relocating the black mamba okay but anyway this was a this was a really big one what we did uh yesterday we had kind of a big brush pile on the property and we moved that brush pile we kind of cut it down and moved it away and i think the thing must have been in that brush pile and we must have uh disturbed him and then he was out looking for a looking for a new place but the kind of scary thing to me was that i hope it was just one i hope it wasn't a nest in there because these things are in fact really dangerous and i had a friend not long ago that got bit by got bit by one just a small one he just thought it was a garden snake saw it on his porch and he got it the thing bit him and it was just a little bitty one and then he realized he had a problem and they made a mad dash to the hospital and he he isn't doesn't live right where i do and he was like 45 minutes from the hospital and like when he got to the hospital he was uh he was to the point of really gasping you know really unable to breathe i believe the black mamba is a neurotoxin which basically kills your nerve where your brain can't send the signal to your diaphragm to breathe and he was in the throes of not being able to breathe but he got there just in time they got enough anti-venom in him that he actually lived but i digress i digress at least i'm trying to put my digressions at the end so if you watched all the way to the end of the video what i need you to do is put the magic word black mamba okay if you get the homework done successfully you type in i'm i'm legend if you mess up i fold it up like a cheap walmart lawn chair okay guys we're going to get to the fun stuff really quick next up next week what i'm going to do is another quick lesson like the one i did today but i'm going to be showing you how to use python environments i'm going to be showing you how to use python environments and that is even the next level of control where you can customize different environments for different projects and the reason for that is is that let's say that i had two projects that i wanted to work on in python 3.9 and let's say the new project that's using 3.9 needed me to install some libraries and when i install those libraries something goes wrong and that library like corrupts my system and then 3.9 i have to reinstall will i lose everything that i had done to configure 3.9 for my earlier projects have to go and reinstall the libraries reconfigure everything so an environment is like a little isolated sandbox that you create and you have python 3.9 on your system once and then as you do projects you work within an environment which then ensures you won't corrupt what's outside that little sandbox and so really as we're starting to do these more advanced things the environment is really important because a lot of stuff we're doing really is on the bleeding edge and so some of these things are very early versions of the software so it's very possible you might even say likely that we're going to do something that might corrupt the corrupt the python interpreter or corrupt the overall configuration and so it's important for us to operate in environments okay guys if you like this give me a thumbs up okay leave a comment down below if you haven't already subscribed to the channel when you subscribe make sure you ring that bell so that you will get notifications when my future lessons come up and uh just leave me leave me a comment down below let me know what you're thinking let me know what you like let me know what you don't like okay paul mcquarter from toptechboy.com i will talk to you guys later
Info
Channel: Paul McWhorter
Views: 10,070
Rating: undefined out of 5
Keywords: Lessons, Tutorial, Tutorials, Artificial Inteligence
Id: I7GKSQeFGQs
Channel Id: undefined
Length: 32min 48sec (1968 seconds)
Published: Tue Jul 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.