The register.py command tries to cleverly find the python to use, based on what venv or conda environment you’re running it in. There are also some flags that let you specify exactly which python you want (register.py --help should print out some docs).
Edit: If you’re running a standalone swift binary, python is configured a bit differently. One way to do it is to set the PYTHON_LIBRARY env variable to the python so library that you want to use.