If you target primary RPi as target, then use the installed Python version of the OS.
If you want a newer Python version, use pyenv.
Install the required libraries, build-essental and git.
https://github.com/pyenv/pyenv/wiki#sug ... nvironment
Then install pyenv:
https://github.com/pyenv/pyenv-installe ... le#install
Do the required steps to add the pyenv command to .bashrc or .profile.
After this stpes, you can build with the help of pyenv as a normal user a newer python version and use it as a user. Do not use it system-wide, because it will break some tool which depends on the Python version delivered by Raspberry Pi OS.
If you use e.G. `pyenv shell 3.13.3` it activates in your current terminal session Python 3.13.3.
If you install packages via pip a virtual environment is not required, but recommended.
Some packages requires additional libraries and some of them requires very long to compile on a Raspberry Pi like `lxml`.
If you want a newer Python version, use pyenv.
Install the required libraries, build-essental and git.
https://github.com/pyenv/pyenv/wiki#sug ... nvironment
Code:
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \libbz2-dev libreadline-dev libsqlite3-dev curl git \libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-devhttps://github.com/pyenv/pyenv-installe ... le#install
Do the required steps to add the pyenv command to .bashrc or .profile.
After this stpes, you can build with the help of pyenv as a normal user a newer python version and use it as a user. Do not use it system-wide, because it will break some tool which depends on the Python version delivered by Raspberry Pi OS.
If you use e.G. `pyenv shell 3.13.3` it activates in your current terminal session Python 3.13.3.
If you install packages via pip a virtual environment is not required, but recommended.
Some packages requires additional libraries and some of them requires very long to compile on a Raspberry Pi like `lxml`.
Statistics: Posted by DeaD_EyE — Wed Apr 30, 2025 10:12 pm