Install and Run Multiple Versions of Python | pyenv

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys I'm Sudan koirala and welcome back to data science basics in this video we will be talking about Pi e and V which is a simple python version management you might be wondering why we need multiple versions of python so there are few reasons one is the compatibility because different versions of python can have slightly different syntax or modules or libraries so you need to make sure that what you are doing is compatible with that particular version of Python and the next thing is a development as a developer you might be developing different projects and for the different projects you might need different versions of Python and the next reason is the Legacy code let's say that you are working with some Legacy code which has specific versions of python so you need to install different python buttons in your system by ENB is the tool which will help you to do exactly that you can have multiple versions of python in the same system so that you can switch between different versions easily there are actually many ways how you can install Pi e and V the recommended way and the easiest way is to use the pi EnV install dollar for installing the pi e and V it says here that this tool is used to install Pi e and V and friends this is the most easiest one I would recommend you because when installing Pi EnV in the system there might be different dependency errors and so on I am using actually Linux for demonstrating in this case if you have a different machines you need to follow different instructions so here it is using call to install the pi A and B right first thing you need to do now is check in your system if you have call install or not if you just type c URL call then it will show something like call try call here that means that the call is already installed in your system if not you need to install call First in Linux is quite simple you can just to sudo apt install call so it will install the call in your system I have already installed call it as you can see before so I will not run this command but one thing you need to remember sometimes it gives some error so before running app sudo apt install call what you might need to do is sudo app update in your system so that it updates all the different dependencies before that so you are ready to go now we have call install how we can install the pi ENB let's go back here and it says call let's copy the command and just paste here this is how you can install Pi e and V into the system I already have installed by EnV but if you just enter this it says that okay warning cannot proceed with installation kindly remove this already because I already have installed by EnV but for you it will install the pi EnV now and if you want to check if it is installed or not you can just type Pi e and V version it will show you what version of Pi e and V is installed let me first check what version of python I have in my system so for that you can just type python Dash V it will show that okay I have python 3.10.4 let's say that you want to work in some project which needs python 3.7.2 that's simple like you can just type python e and V you can say install Dash V and you can just provide 3.7.2 and then you can type install now it will face that particular version of python in your system it will take some time I will come back when this is done it took some time but now you can see that it says it installs python 3.7.2 in that particular folder now if I do PI e and V and then if I type versions now you can see that there are two different versions of python in my system one is 3.7.2 and one is system so the one that we had before 3.10.4 now that is known as system for this case let's say that you want to use the 3.7.2 globally in your system instead of the 3.10 how you can achieve that is Phi e and V there is a command let's say let's first go with the commands that is that we that the pi e and V has so you can see here there are different commands out of this what we can use is pi e and V and if you type Global and if you give the name of the version of python what we just installed is 3.7.2 right if we again go and see Pi e and V versions now 3.7.2 is set by default or globally in our system so if you install something now it is going to use Python version 3.7.2 okay this is great but now there is one more thing that is really helpful now let's say that you create a project let me give the name make directory project I can go inside that project right and now let's say that I want to use again 3.10.4 for this particular project so what you can do now is we we are inside the project and now you can go and say Pi e and V and local is another command we have I want to use one that particular version of python only in this project so if you type system now we want to use 3.10.4 and if I do PI e and V versions now you can see that 3.7.2 is now changed to system something here that is really interesting before when we had this different when we set it as a global here you can see that it is showing slash home Kodi space dot pionv dot version so that is the global of our sum of python but now when I want to use it inside the particular project so it is going to be workspace project dot python version so you see the difference there it is now using locally in that particular folder only and if I do LS there is nothing but if I do Dash l s l i a meaning that if there is some hidden folder or file there dot python version so let's say what is inside that cat dot python is dot python version you can see there is the system meaning that it is going to use that particular version of python in our case system is 3.10.4 as I said before for this project only so that is that simple and let's say that in in future you might have different projects where you need different versions of python or you might be working with some code which uses python 3.1 for example then you can quickly switch back between different python versions for that particular project only yeah this is all I want to show in this video in the next video I will show you how you can create virtual environment and use this particular python versions in it thank you for watching and see you in the next video
Info
Channel: Data Science Basics
Views: 843
Rating: undefined out of 5
Keywords: python, manage multiple python versions, how to install python, how to install different versions of python, how to python, how to pyenv, pyenv linux, pyenv install, pyenv tutorial, pyenv virtualenv, different python versions, pyenv update, python install, python uninstall
Id: 1dKw8q-Bod4
Channel Id: undefined
Length: 7min 27sec (447 seconds)
Published: Sat Mar 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.