I love you man, I legit just lost a whole day trying to get a virtual environment running for a specific python version. After so many methods and attempts, this was such a simple implementation. I can finally go to sleep
Thanks, great explanation ! I just can't change the version for my virtual environment. I followed the steps in the same venv folder but can't uninstall python 3.11 (it was installed by default) and i can't impose 3.8 that I need. Thank you for you time.
Hi sam!, great video, but i had a problem, how do i install library on the virtual environment? for example i want to install opencv in python 3.9.6 , i've try to 'sudo apt-get install python3-opencv' after i'm inside the virtual environtment, but it didn't work
It seems using pyenv global doesn't apply to a virtualenv I have created. I've tried doing different things including the eval "$(pyenv init -)" command and saving it to the bashrc file, but the virtualenv always defaults back to 3.9 when activating it. I've also looked into using pyenv virtualenv, but that doesn't seem to work in my case. Is there a simple way to set the pyenv in the virtualenv and have it remain that way?
You're going to have to remake your virtual environment. It's not too hard though. The reason why is because a virtual environment stores its own version of Python, so your virtual environment ignores the Python from pyenv and uses its own version. I have a video on virtual environments if you'd like to learn more. th-cam.com/video/MfVOUSGbe60/w-d-xo.html
why is this giving this error bash: /home/pi/.bashrc: line 125: syntax error: unexpected end of file when I save and exit the following command export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)"
when installing the long list of system packages i get lots of errors saying `sudo apt fails to fetch ...` what can be the reason? infact because of these not getting installed, i am unable to use pyenv at all
Hi. I need to use GPS module code in thonny which uses python 2.7.9, but my other module codes in thonny use 3.7.3 can you tell me a solution for this please?
On my end i got stuck installing python 3.11.1 on my zero and zero 2, the solution was increasing the swap space to about 512 MB or 1024 MB with the following command: sudo nano /etc/dphys-swapfile and then changing the 100 MB Line
hello i have watched your video about pyenv i installed python 3.6.5 on raspberry pi 4 and globaled it instead of 3.9 while i am creating virtualenv on pycharm it is asking to choose base interpreter which file do i choose?
Bro if I type pyenv install 3.7.12 it shows downloading few lines come and it freezes at line showing patching file config and doesn't move forward can you help me?
Hello, I want to ask. The default python on my previous raspberry was 3.9, and I installed python globally 3.7 as in this video because there is a need. But when I want to run my python program through Thonny Python IDE and use python 3.7, all libraries are not listed (like picamera etc.), when I want to download the required library it says "library already exists", but can only be used when I use python 3.9 in Thonny IDE... How do I install/access those libraries in python 3.7? Thank You
It looks like thonny comes with its own version of python 3.7. How do you install libraries? Thonny suggests you go Tools -> open system shell and install packages from that shell
hi there thanx for you great tutoriel . i followed all the steps without any error but when i to switch to 3.7.12 i chekc the version of the python and it still the 3.9 !! pyenv local 3.7.12 dont give any error .. do you have any idea why .?? thanx
If you run the command, pyenv local 3.7.12, and immediately check your python version, python -V, does it still show 3.9? My guess is you changed folders after running pyenv local 3.7.12. Pyenv local only changes the python version for the folder you're in.
@@SamWestbyTech i'am still in the same folder i only check the version before and after the peyenv local and it shows the same version .. even pyenv global dont change anything
@@NaturallyGlowDIY I don't know if the problem is solved or not, but I had the same issue and realized that when I run python3 --version, instead of python --version, I get my desired python version but with python --version I still get the default python version even after pyenv global command. So just try with python3 and I guess that's it.
My rasbian OS python -V is 3.7.3 and I installed python3.9.2 through pyenv but when I try run openCV example code , I have a error like this Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /home/pi/3.9.2/fall/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-arm-linux-gnueabihf.so)
I love you man, I legit just lost a whole day trying to get a virtual environment running for a specific python version. After so many methods and attempts, this was such a simple implementation. I can finally go to sleep
Thanks, great explanation ! I just can't change the version for my virtual environment. I followed the steps in the same venv folder but can't uninstall python 3.11 (it was installed by default) and i can't impose 3.8 that I need.
Thank you for you time.
Thanks! Very clear and concise
Hi sam!, great video, but i had a problem, how do i install library on the virtual environment? for example i want to install opencv in python 3.9.6 , i've try to 'sudo apt-get install python3-opencv' after i'm inside the virtual environtment, but it didn't work
It seems using pyenv global doesn't apply to a virtualenv I have created. I've tried doing different things including the eval "$(pyenv init -)" command and saving it to the bashrc file, but the virtualenv always defaults back to 3.9 when activating it. I've also looked into using pyenv virtualenv, but that doesn't seem to work in my case. Is there a simple way to set the pyenv in the virtualenv and have it remain that way?
You're going to have to remake your virtual environment. It's not too hard though. The reason why is because a virtual environment stores its own version of Python, so your virtual environment ignores the Python from pyenv and uses its own version. I have a video on virtual environments if you'd like to learn more. th-cam.com/video/MfVOUSGbe60/w-d-xo.html
why is this giving this error
bash: /home/pi/.bashrc: line 125: syntax error: unexpected end of file
when I save and exit the following command
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
when installing the long list of system packages i get lots of errors saying `sudo apt fails to fetch ...` what can be the reason? infact because of these not getting installed, i am unable to use pyenv at all
thanks for sharing!
Saludos 🇲🇽 good video
Hi. I need to use GPS module code in thonny which uses python 2.7.9, but my other module codes in thonny use 3.7.3 can you tell me a solution for this please?
does python 3.9.2 supports tensorflow
On my end i got stuck installing python 3.11.1 on my zero and zero 2, the solution was increasing the swap space to about 512 MB or 1024 MB with the following command: sudo nano /etc/dphys-swapfile and then changing the 100 MB Line
Good catch!
How to run a script in env on reboot...
Thanks a lot
Thank you very much, big love bro
hello
i have watched your video about pyenv
i installed python 3.6.5 on raspberry pi 4 and globaled it instead of 3.9
while i am creating virtualenv on pycharm
it is asking to choose base interpreter
which file do i choose?
Depending on your device type “which python” in a terminal. This should be your base interpreter
Bro if I type pyenv install 3.7.12 it shows downloading few lines come and it freezes at line showing patching file config and doesn't move forward can you help me?
How long have you left it running? That part takes a while
Hello, I want to ask. The default python on my previous raspberry was 3.9, and I installed python globally 3.7 as in this video because there is a need. But when I want to run my python program through Thonny Python IDE and use python 3.7, all libraries are not listed (like picamera etc.), when I want to download the required library it says "library already exists", but can only be used when I use python 3.9 in Thonny IDE... How do I install/access those libraries in python 3.7?
Thank You
It looks like thonny comes with its own version of python 3.7. How do you install libraries? Thonny suggests you go Tools -> open system shell and install packages from that shell
In the thonny shell could you run
python3 -V
And
pip freeze
Would this work with Bullseye Debian on the Raspberry Pi?
Yes it will!
thank you so much
Nicely done! Greatly appreciate the instructions
thanks, great job.
Thank you
This video was so helpful for my work.Thank you much Sam ! Appreciate it :)
Thank you! Happy to help
hi there thanx for you great tutoriel . i followed all the steps without any error but when i to switch to 3.7.12 i chekc the version of the python and it still the 3.9 !!
pyenv local 3.7.12 dont give any error .. do you have any idea why .?? thanx
If you run the command, pyenv local 3.7.12, and immediately check your python version, python -V, does it still show 3.9? My guess is you changed folders after running pyenv local 3.7.12. Pyenv local only changes the python version for the folder you're in.
@@SamWestbyTech i'am still in the same folder i only check the version before and after the peyenv local and it shows the same version .. even pyenv global dont change anything
same with me, python version didnt change.
but i ran: eval "$(pyenv init -)"
and after this it worked as required
@@AnuragVarmaP Interesting. Did you also add eval "$(pyenv init -)" to the ~/.bashrc file and restart your terminal (Step 2 and 3)?
@@NaturallyGlowDIY I don't know if the problem is solved or not, but I had the same issue and realized that when I run python3 --version, instead of python --version, I get my desired python version but with python --version I still get the default python version even after pyenv global command. So just try with python3 and I guess that's it.
Does python 3.9 support opencv
yes it does!
@@SamWestbyTechthank you. But in Google it's says that opencv is not supported in python 3.9 🥲
My rasbian OS python -V is 3.7.3 and I installed python3.9.2 through pyenv but when I try run openCV example code , I have a error like this
Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /home/pi/3.9.2/fall/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-arm-linux-gnueabihf.so)