Updating python under Gentoo is not always straightforward work. Despite a clean upgrade without any blockers or masked packages, sometimes, on old machines, there might be packages left still built against an old version of python, which is no longer available on the system!
On Gentoo, there are two important flags in the configuration make.conf file:
PYTHON_TARGETS="python3_8 python3_10" PYTHON_SINGLE_TARGET="python3_8"
The PYTHON_TARGETS and PYTHON_SINGLE_TARGET control the support of multiple Python versions installed on the system. When the Gentoo package has a use flag python, the builder emerge will build the python module for all the Python versions in PYTHON_TARGETS. Some programs or libraries may not support multiple versions to be installed on the system and they may require to specify just one Python library target, against which they are going to be built and that’s why PYTHON_SINGLE_TARGET exists. In most cases, the PYTHON_SINGLE_TARGET should be the active (default in the system) Python version.
Keep on reading!