I have tried recently manually installing python3.9 version in my Ubuntu from 3.6 version using apt install python3.9
. Then pip3 was broken. The issue is because distutils were not build for the 3.9 version.
So in my case I ran apt install python3.9-distutils
to resolve my issue.
In your case make sure to modify 3.x version in distutils command.