Installing Python, Pip and IPython with PyEnv - Free Full-stack Course 🦄

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone and welcome to this chapter of the free fall stack course in this chapter we're going to install python pip and ipython using pyenv if you follow the chapters in this course chronologically you should now have pyeam installed independent of your operating system whether it's a linux based operating system or if you have windows or mac os because we've already done the installation all these three operating systems this chapter is part of the free full stack course however you can also follow along with this chapter if you're just here to install python ipython or pip using pyam on your destination operating system if you're interested in the free full stack course the link to the entire courses playlist is at the bottom of the screen as part of the description of this chapter now if you've installed pym on your computer already by following along with the chapters chronologically then you should actually rejoice that the installation of python pip and ipython is going to be very very easy with pyam because pyems commands work exactly the same on linux as they do on mac and they do on windows as well so you don't really have to worry about moving between operating systems if you're used to pi f so what we're gonna do in this chapter is just gonna i'm gonna explain the instructions on mac os but the same instructions apply to both linux and windows when it comes to pi amp we have three very important versions that we have to keep in mind basically the way that we manage python versions is from the terminal or the shell as some call it as well so pyeam has the ability to set a specific python version for your entire shell session so that is a pi m version for your shell there is also versioning for a local python version using pi amp and then we also have a global version so let's start with the global version when you set a python version globally with pi amp then your entire system is going to use that version whenever there are no more specific versions specified by either the local version or the shell version so let's just imagine a world where you haven't set any versions for python in your operating system using pi amp and you start with a global version of 3.0 then when you start a new shell pym is gonna look at the version set in the system it's gonna first start with the shell version there are no shell version set then it's going to go to the local version and there are no local versions set either so it's going to look at the global version and say okay 3.0 is the global version that i'm going to use in this shell session then you go ahead and become a little bit more um comfortable with pi m and set a local version in a specific directory on your computer for instance where we're going to create our back end then you set that local version in that directory to 3.1 for instance the next time you up start your shell then let's say that the shell starts or your terminal starts in your home directory and not in the directory that you set another python version of 3.1 python is going to look exactly sorry pi m is going to look at exactly the same process again it's going to first say do i have a shell version set no we don't do i have a local version set no we don't because right now we're in the home directory and not in the directory that we set the local version previously then it's gonna default to the global version which is 3.0 as soon as then you issue a cd command for instance in your terminal to navigate to the folder that you'd previously set a python version using pi amp locally payment is going to understand that here is a specific version set for this particular directory then it's going to switch to that version for you which is 3.1 and then if you then go ahead and become even more comfortable with pi m and then you start setting shell versions the next time you start your shell let's say that you close your terminal and you start a new shell session then payment is going to first look at oh do i have a shell version set let's say that you set it to 3.2 previously then it's going to use the 3.2 version and it's not going to go to the global version which was previously set to 3.0 so i just want to tell you about the structure of how pi am actually uses python versions which is global shell and then sorry global local and then you have shell okay so it's very important to grasp and also you could argue that local and shell could be fighting sometimes with each other but as you start doing more and more work with pi if you'll understand how it actually works so you don't have to worry about that okay so let's go to the next instruction which is actually installing python with pyen so i'm going to do some screen reshuffling in here let's see if i can get this right so here we have a terminal window open and as uh if you followed along with the chapters in this course chronologically you'll know that i really prefer to use item 2 and also all my zsh as my shell and there are instructions in this playlist which as you can see at the bottom of the screen the link to if you go in there then you'll also see the chapter that that relates to creating an environment like mine actually installing item 2 etc so i really recommend that you actually have the same setup as i do which makes the whole process easier for both of us so as you can see at the bottom of the screen you can you can install a specific version of python using pym install and if you want to see all the available python versions for your operating system you have to type pym install and then dash dash list and you can see in here there are so many different forks of python and different versions of python that you can install so we have miniconda for instance and then we have anaconda and then also we have just vanilla versions of python and usually i go with the vanilla versions of python but some of you may actually for instance prefer to use anaconda which comes with some specific packages that you prefer so i can see in here for instance the latest version that is actually available for my operating system is 3 10 4 and then you actually can install this version using the same command pi m install and then 3 10 4 or you can say 3 10 1. so let's go ahead in here and say that we want to install 310 for and again depending on your operating system this version could be different so let's say that the version that might be available for all operating systems could be 3 10 0 maybe on ubuntu the latest version is 310.1 maybe on a specific mac os version the latest version available is 310.2 but we could be certain that at this point 3 10 0 should be a version that is available for all operating systems or the the three operating systems that we're targeting in this course the linux windows and mac os so let's go ahead and try to install 3 10 0. so i'm going to clear the screen and let's say pi install 310.0 and this process is just going to go ahead and it's going to do the installation and this could take some time so let it do its thing and then we'll continue with the video after that okay that was fantastic this process took perhaps about a minute or two on my computer it could defer though on your operating system and depending on your hardware for instance so i can see in here that i got a message perhaps you can't actually see it i'll bring it up here so it's not obstructed by any labels on the screen i can see that pym is saying install python3102 and then it's telling me where it has installed that version so you may sometimes actually be curious about which versions of pi amp you have installed on your computer using using pi app actually so if you say pym and then you say versions then you should see various versions that are installed on your computer and at which level they are for instance and when i say level i really mean that different places inside your computer and different directories different programs can have specific versions of python locked for that particular program for instance or for that particular folder so it's very important then to be able to use python and sorry to be able to use pi in order to see the versions available also and also the versions that are being used by different levels and things inside your computer so if you want to see the available versions at least you can always use pi amp versions and i can see in here 310 0 is available however right now 310 2 is being used so um if you want to then be able to use a specific version of python we're going to see that actually soon in a minute but then you should be able to use one of the commands provided here so if you say pym if i change the size a little bit because the formatting gets a little bit messed up i believe if the font is too big there are three important commands for pi amp here for managing the versions one is global okay we talked about global already then we have local and also we have shell so these three commands we're going to be using them throughout this course in order to manage various versions of python for our backend for instance okay so before we talk about that you may also get a message during the installation of python that pip which is a package installer for python is out of date and then the way to upgrade pip i mean if i type pip in here okay you can see the commands for pip and if i say which pit i can see that is actually inside pi amp at the moment okay if i say pip version i can see the version for pip as well however if during the installation of python you got a message saying that pip is out of date in order to update pip you can actually say python let's see which python python and module pip so this m is for module and then you say install and then you say upgrade pip okay so if you do that then pip is actually basically your upgrading pip using python and pip itself okay so that's that's also something that you could do in order to make sure that you have the latest version of pip now let's talk a little bit about versions of python and actually using specific versions of python for your for your shell for instance so we're inside a shell right now if i say python version i can see that 3 10 2 is being used currently and then if i say which python i can actually see that the current version which is 310 2 is being managed by pi m now we also installed python 310 which is perhaps the version that we're going to use for our entire backend throughout this course unless we are going to change it later so if i say pym versions you can see that 310 is a version that we've successfully installed on this computer so how can we use that version there are three ways of doing that you either set it locally or you set it as your shell version or you set it globally okay so if in here i say pi m and i say for my current shell i want to use 3 10 0. it's a python version i can now see 310 is being used for my shell and i can actually close this item window and i can create a new one i'll bring it up okay let's change the font size the font size a little bit and if i say pi amp and if i say python version you can see now it is being reset to 3 10 too and that's because when i said that i want a specific version of python for my current shell i meant really for my current shell it doesn't mean that every time that i create a new shell window or a new terminal with a new shell that that version is going to be used so the pi so basically using pi amp shell and you're setting only the current shell or the current terminal windows um actually we can't call it really windows because for instance in item you can create a whole new shell inside the same window and this ver this shell at the bottom will have its own independent version from this shell because there are two completely different shells so we can't even call it window we just should really call it a shell and later in this course we'll have a look at how we can set local shell and global versions and where they're actually useful so for now all you really need to know that we have a python version of 310 installed hopefully both actually on all three platforms so linux and mac os and windows and if you don't have 310 available on that operating system please do let me know in the comments at the bottom of the screen so perhaps we can design this course using a version that is commonly available on all three platforms but last i checked 310 was available on ubuntu windows 11 and the latest version of mac os so we're pretty much done with the installation of python and pip using pi amp on our target operating system with all that said we can now go to installing ipython in the previous chapters in this course i've already talked a little bit about what ipython is and why it is useful and in this chapter we're going to go ahead and actually install ipython using pip so now that you've installed python and pip on your computer using pyeam we should be able to use pip to install i python which is an interactive python shell which is a rapple so if you're already for instance familiar with some other rebels for instance the swift repo you should know what that is but all you need to know is that ipython allows you to write python code in the terminal interactively so it has auto completion for you it has syntax highlighting and a lot more so let's just go ahead and follow the instructions at the bottom of the screen in order to install ipython so i'm just going to say pip and then we're going to say install ipython and i already have ipython installed and but that was perhaps using another python version so you can't see it but this command actually succeeded so i can now see that ipython is installed so i mean it doesn't really say that ipython was installed but in my mind if i don't see any errors i know that the command succeeded so if then in here we say which ipython you should see that ipython is actually now an available command inside pi amp as a shim we've talked briefly about shims before when i introduced pyev in one of the previous chapters but shims are pi m's shortcuts to various python executables so in this case pym is taking control of what ipython actually means to the current session in the terminal so whether it's a local python version set or a global or a shell version set the shim for ipython is then going to delegate the execution of ipython to the to the correct ipython version for the uh for that terminal for instance or for that folder if we have a local uh python version set so we now have ipython installed so we should just be able to write ipython and go into the ipython rapple and then we should be able to use various functions in here for instance print etc and then we should be able to say exit to exit the ipython wrapper if you've done this then you have ipython python and pip installed on your computer and um we're going to use this video as basically the base for many upcoming chapters so though it's a is a short video but it's very important because it basically lays the ground for installing the correct version of python for the rest of this course so again i'm assuming that 3 10 0 is a version that's available on all and linux and distributions for all modern and updated linux distributions windows and also mac os if it is not if you're having trouble installing a 310 version of python on your destination operating system please do let me know which operating system you have which version it is and which version of python is the latest version available and maybe not even the latest because on my mac operating system i had three ten four available but we didn't actually install that because i know on another mac operating system that i have at home since that is not the latest then 310 ford wasn't available it was actually 3 10 2. and i believe 310 4 is available mainly for apple chips so if you have an intel mac for instance then you may not even see 310 for as unavailable versions to install as a python version with all that said really the point in here is to install 310 on your destination operating system if you couldn't do that please do let me know in the comments at the bottom of the screen i really hope that you enjoyed this chapter and and if you have any questions as always just let me know in the comments and i'll do my best to answer you as fast as possible so that was that for this chapter and i'll see you in the next one
Info
Channel: Vandad Nahavandipoor
Views: 2,602
Rating: undefined out of 5
Keywords:
Id: l1sMbTgzWpo
Channel Id: undefined
Length: 18min 43sec (1123 seconds)
Published: Wed Jun 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.