Install Multiple Python Versions on Raspberry Pi

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i'm going to show you how to install and manage multiple versions of python on your raspberry pi i'm using a tool called pi m here's the github page it's a pretty popular page with almost 26 000 stars and it's widely used to install i'm going to be using their pi ev installer commands it's easier than trying to follow the install commands on here and also it's less version specific i will note if you're trying to replicate this on a windows computer you have to use a different installer but for unix raspberry pi mac it all works i'm going to access my raspberry pi right here plugged in over ssh maybe you have it plugged into hdmi with keyboard and mouse so you can just go right onto your raspberry pi or if you're using vnc regardless we want a terminal window so in any case get to the terminal of your raspberry pi however you're comfortable ssh pi at raspberry pi then my password let's follow this first instruction i have here this downloads and installs pi m but it doesn't add it to our path which we need to do without it being in our path we can't just say the command pi m if we need to go into the directory and it's just so much work and we can add this to our bash rc and then it's in our path we can just say pi m command so to get into a bash rc sudo nano squiggly dash dot bash rc go to the bottom of the page and just paste this text here ctrl s to save control x to exit the bash rc is run every time the raspberry pi is reboot so it hasn't run yet and it doesn't know that pi m is in our path we need to restart our shell to do that we run the command exec dollar sign shell in all caps now i skipped ahead here but we also need to install all these system packages you're going to find when you start using pi amp later you'll get all these odd errors saying like this package is missing blah blah blah blah and by installing them all now we save some trouble in the future and we already restarted the terminal as stated in number four and now let's update pi m pi pi m update okay so we got pym up and running on its latest version now how to install python we go pi m install and then we can do list and see what our options are we got a bunch mini conda anaconda all the regular python versions back to 2.1.3 so all we got to do is run pi m install i'm going to do 3.7 3.7.12 click enter it's going to take about 10 minutes and then i'll see you when it's done once it's installed we actually need to use the python version right now my python version python capital v you could also do python dash dash version is 3.9.2 so how do i make my 3.7.12 become my python version we got a few options the first is pi m local how this works is it sets the python version of your folder to be whatever python version you tell it to so i'm going to make a folder so now i have a folder temp i'm going to change directories into temp cd temp and now python version it's 3.9.2 but then when i run the command pi m local 3.7.12 and i do python-v that's now my python version if i go back out of the temp directory and do python-version it's 3.9.2 option number two pi m shell i just took a look at the readme and it looks like the pyam shell is for advanced users who really know what they're doing with shell commands so if anyone's interested in me doing a tutorial on that let me know another one that you can use instead of payment local or pie m shell is pi m global and that will permanently set your python distribution so if i do pi amp global it's going to be python 3.7.12 not 3.9.2 and then finally to uninstall say you installed it with me and you don't want it anymore just these two commands and that's it you can have multiple python versions do as many as you need install as many as you need and then you can just pi m global pi am local to switch around between different python versions no conflicts no problems no hassle let me know if there are any other tutorials you want me to do i'm happy to do them subscribe for more tutorials in the future give it a thumbs up if it was helpful thanks for watching
Info
Channel: Sam Westby Tech
Views: 18,021
Rating: undefined out of 5
Keywords: how to use pyenv, pyenv raspberry pi, how to install pyenv on raspberry pi, python setup, setup multiple python versions, install python on raspberry pi, how to manage multiple python versions, pyenv tutorial
Id: QdlopCUuXxw
Channel Id: undefined
Length: 5min 11sec (311 seconds)
Published: Tue Jan 18 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.