Install (and uninstall) ANY Python version on Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
installing and uninstalling python Linux is pretty weird for some reason there's no obvious way to uninstall a python distribution once you've installed it and if you use the repositories like the app repository or the Pac-Man repository or whatever well I can't speak for the Pac-Man one personally but at least for apt and maybe some others as well the latest version of python on the repositories isn't particularly up to date I do know you can use the dead snakes PPA but even that's not super up to date all the time and it's just weird and annoying and it can kind of wire itself in even if you already have a version of python still that other version can then wire itself in to interoperability and then if you remove that it all breaks and it all gets a bit messy however there is an easier way to download and install python or any python version you want for any you know distribution you want and it is by using the FTP server so if we were to go on to you know this web address here www. iphone.org FTP slash python we can see that all of these individual versions of python are here waiting for us and if you're going to you know version 3.9.9 for example and we have you know all our exes all our Mac installs all our tar gzers and Target Z files and all that stuff and this is what we're getting at actually access to download build and then install the source code for each individual python version so this means that when a python update comes out say for example python 3.10.7 came out recently you can install that straight away without having to wait for the uh you know the ppas or the standard packages to update themselves I don't actually know what the latest one on the out repository is but I do know that for a really really long time whether it Stills or not it was really far behind but either way this would give you much faster access to those newer versions if you want it doing this manually so you know downloading touchy Zed extracting it building in configuring installing all that stuff normally takes quite a few commands however you can simplify this using scripts you don't have to build your own because I've already done that for you I've been using this install script for quite a while now myself and it's worked really well for me and I thought I would share it with you and I thought I'd also include an uninstall script as well so you can quickly uninstall stuff so if you want to install patch version for example then you can do that so we're gonna get clone uh https github.com power of see uh spell my own username that would be nice a known python grips now clean the net and if we just see the into Python scripts real quick you can see that we have our install python we have our uninstall Python and then we have our license to read me it is unlicensed um I put the license in there just to say it's a public domain you can do what you want with it I don't care um I'm just not responsible if you go breaking your computers for your modifications or anything like that just want to get that disclaimer out of the way before I get blamed for ruining people's computers and then we can actually make them executable by doing chmods plus X install python and in chmod plus X uninstall python it's just a mean that we don't need to CD into the directory or we don't need to specify bash we can literally just do install python it'll work however right now that only works in this directory if you want to make it work in any directory you can come back out here open up your relative RC file for your distribution uh for me it'd be or be for your terminal share not distribution actually because this is a raw version of Ubuntu it's bash you might have a zero zsh RC if you want come down to the bottom and then do export path equals a dollar path colon tilde Python scripts and this will add that to the path and then we do Source bash RC as well now add it to the path so now we can run our install and uninstall scripts from anywhere so the install script uh kind of takes python versions like this so you have 3.10.7 for example would install python version 3.10.7 you can install beta versions as well so if you wanted um the latest I think the latest version of 3.11.0 is beta 5. you could do that and it would install a 3.11.0 beta 5. if you provide a python version that doesn't exist then it will complain and say that it doesn't exist it also cannot automatically work out what the latest version of python is I have tried to figure out how to do that but I can't seem to be able to work it out myself um this is about as complicated as I've ever gotten with bash scripting so if someone doesn't know how to do it and feel free to maybe contribute or add another script into the repository if you want we're just going to install a python 3.10.7 for now and we're going to do WSL and then I'm going to put this over to this side I'm going to bring my thing over and I'm going to show you how it works so first off it's when my internet catches up there we go first off so it checks if you pass at least one python version uh did this okay there we go oh it's having to do some crazy update I updated this specifically so this didn't have to happen oh well whatever if it takes too long we'll just skip past it I can always edit it out so first it you know updates repository and upgrades everything just to make sure everything is up to date then it installs all of this stuff so wget is so it can actually download the taji Z files uh everything else is just so it can actually build it oh what is going on here really oh no it's working now okay we're just gonna leave that I don't know what's going on there but it does seem to be working fine hopefully that's also not too distracting on the side as well I might darken that any edit if it is too much um then it changes into our temp directory then has to work out what version of python to install and it needs to do a little bit of weirdness with it because say we wanted to install a release Canada version for example if we did if we went into 3.9.2 folder here 3.1.2 rc1 is here but it's in a folder called 3.9.2 so basically just needs to work out what folder to use and what um you know what actual specific Target needs once it's worked that out it then goes and downloads it and then checks to see if he actually downloaded anything and if it didn't then it just exits out then if it did download something then it extracts it using the tar file format then it builds it so I think we've already gone part here there we go building python 3.7 up here um so it's CDs into our file and then configures it with all these different things and then it actually makes it using all of your processes and then after that I just installed it so as I said before the main uh benefit of doing this is that you don't have to wait around for the package managers to update themselves you can just download whatever python version you want whenever you want you can even download a legacy version if you want to the only issue is that the actual installation time does take a lot longer because the ones on the package managers are probably pre-compiled so it just needs to download something and then install it with this it actually just need to build everything it needs to run all the tests and then once it's done all that it needs to then install it separately which in itself doesn't take too long um but you can install as many python versions as you want in one go normally when I'm setting up a new wslr and store you know the latest beta version the latest stable version and maybe one other version all at the same time and I just leave it to go but yeah while it's running all its tests I am going to cut here and we'll catch up with it once it's done and we'll make sure that it all works perfectly fine one thing I will actually mention before we get there uh just interjecting myself here is that for python versions 3.7.x and down I think uh these tests take significantly longer there are like 400 and something tests instead of 44 so you're going to be waiting a lot longer for those earlier versions to install as well so that's maybe something to keep in mind um but then I don't really know if you can install them outside of maybe Docker or something so who knows okay the tests are now done is rebuilding with profile guided optimizations so it then has to rebuild everything and there we go it's all done you get this huge when it's installing you get this enormous just flood of messages that come through I don't even know where the install Echo is to be honest I tried to suppress the output as much as possible but it doesn't matter how many flags I put in it still outputs a load of stuff like this dash s is supposed to be a silent this Dash queue is supposed to be a quiet it doesn't work I don't know if anyone has any answers to that do let me know because it's kind of infuriating but now if we were to run python 3.10 we have python 3.10.7 installed how cool is that and you can use it and you can do whatever you you want with it and it's all well and good and it doesn't interfere with the pre-built uh version or the pre-installed version which I think is 3.8.10 on this particular uh WSL Ubuntu installed so what happens when python 3.10.8 comes out and you want to uninstall 3.10.7 and get 3.10.8 well this is where the uninstalled python script comes in so this one is a lot more brute force it does the same check as before it makes sure that you want to uninstall all the versions you want to uninstall and it can take multiple of them as well it does the same thing and then it just removes all the files uh that python is in for that particular version so I went through and I looked through them all to see what what was there and these are the ones I found if there are any other ones I don't know about them I'm pretty sure they don't exist you know I did wear his commands and stuff like that and this is all that came up so it just goes through deletes all the directories and all the files of python version you want to install so simply you can do uninstall python 3.10 it will then warn you about it you're about to uninstall the following python versions 3.10 this action is irreversible are you sure you want to continue yes and then it's done it's a lot quicker than installing it destruction is so much faster than building but now if you're on python 3.10 it doesn't work anymore we just get an error saying no such file or directory and now you can go and install you know whatever other version of python 3.10 you want now I should say you may have noticed that we haven't supplied you know 0.7 here that's because the files themselves are stored as you know like python 3.10 Pi doc 3.10 pip 3.10 it's um things like that maybe should really have showed that off to be honest um I might try and get a a screenshot of my of my Debian one to kind of shut it off but it doesn't store these in different patch versions and this is why you're not supposed to install multiple patch versions at the same minor version of python because it may or may not cause problems I don't know I've never actually tried to do it so I don't know what happens but if you do have multiple minor versions or multiple patch version sorry I'll python installed and you wouldn't want to uninstall one of them then you have to uninstall all the others as well it's just the way it goes over this uninstalled just because of the way that python organizes its directories but yeah that's pretty much everything um if you have any other you know ideas for scripts that you want to do feel free to contribute to this repository it's brand new I said I've been using the install python script for a while I just moved it into a new repo for the sake of this video and for the sake of having the uninstall one in there so if you do like it the movie give the project a star as well then maybe like the video and subscribe if you want to see more things like it if you do have any ideas about what you want me to do in the future then do comment them down below I read every single one so if you could to hear your feedback if you want to support this channel monetarily you can do so in two ways one by using the join button to become a member and two by using the link in the description to become a patron one Panama either and you can be on this screen like these people and I will see you in the next video where I don't remember what we're doing but I'm sure it's going to be fun so I'll see you for that
Info
Channel: Carberra
Views: 14,872
Rating: undefined out of 5
Keywords: pyfhon, pytho, pytbon, pytjon, ptyhon, pytyon, ptthon, pyyhon, pythn, pythoh, pythpn, ython, pytgon, pyhon, pytohn, phthon, oython, pthon, pyghon, pythoj, pythno, pythkn, ypthon, pytuon, lython, pyrhon, pythom, pythob, puthon, pgthon, python, pyhton, pythln, pythin, pytnon, pyton
Id: S4HfueSI-ow
Channel Id: undefined
Length: 12min 34sec (754 seconds)
Published: Fri Oct 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.