I have problem with multiple versions (Python 3.7 from old Debian 9 buster, Python 3.9 from new Debian 10 bullseye and third version Python 3.9 installed from source). Apache with mod_wsgi failed, because work with sites_packages from other version than I want run. Long story…
1/ Show installed packages with „python“ keyword with command: dpkg -l | grep python
ii libpython2.7-minimal:amd64 2.7.18-8 amd64 Minimal subset of the Python language (version 2.7)
rc libpython3.7-minimal:amd64 3.7.3-2+deb10u3 amd64 Minimal subset of the Python language (version 3.7)
rc libpython3.9-minimal:amd64 3.9.2-1 amd64 Minimal subset of the Python language (version 3.9)
ic python 2.7.16-1 amd64 interactive high-level object-oriented language (Python2 version)
ii python-pip-whl 20.3.4-4+deb11u1 all Python package installer (pip wheels)
iF python2-minimal 2.7.18-3 amd64 minimal subset of the Python2 language
ii python2.7-minimal 2.7.18-8 amd64 Minimal subset of the Python language (version 2.7)
ic python3 3.9.2-3 amd64 interactive high-level object-oriented language (default python3 version)
rc python3-cupshelpers 1.5.14-1 all Python utility modules around the CUPS printing system
rc python3-uno 1:7.0.4-4+deb11u1 amd64 Python-UNO bridge
rc python3.7-minimal 3.7.3-2+deb10u3 amd64 Minimal subset of the Python language (version 3.7)
rc python3.7-venv 3.7.3-2+deb10u3 amd64 Interactive high-level object-oriented language (pyvenv binary, version 3.7)
rc python3.9-minimal 3.9.2-1 amd64 Minimal subset of the Python language (version 3.9)
rc python3.9-venv 3.9.2-1 amd64 Interactive high-level object-oriented language (pyvenv binary, version 3.9)
2/ For all packages run command: dpkg –purge [name of package]
3/ install Python on clean Linux machine without python broken dependencies with command: apt install python3.9
4/ Thats`all. Test command: python3.9 -V
Python 3.9.2