pyenv and pyenv-virtualenv together solves this for me. Virtualenv with specific python versions that work together well with other tools like pip or poetry.
It boils down to something like
$ pyenv install 3.12.7
$ pyenv virtualenv 3.12.7 myenv
$ pyenv activate myenv
and at that point you can do regular python stuff like pip installing etc.
You misunderstand, the first two commands are just one time setup to install a specific python version and then to create an env using that version. After that all you need is `pyenv activate myenv´ to drop you into that env, which will use the correct python version and make sure everything is isolated from other environments you might have.
You can also just create an env with the system python version, but the question was specifically about managing multiple versions of python side by side and this makes that super easy.
You could also combine it with
direnv
to automatically drop you into the correct environment based on the folder you are in, so you don’t have to type anything after the initial setup.