Either with pip:
pip install git+https://github.com/psf/black.git@1aa4d5b
Or with pipx, which looks like a python equivalent of npx, and allows direct runs without installation, or for multiple versions to co-exist:
pipx install git+https://github.com/psf/black.git@1aa4d5b
Ref: [1]