reference [https://stackoverflow.com/questions/26660287/how-to-embed-python-in-an-objective-c-os-x-application-for-plugins] https://stackoverflow.com/questions/26660287/how-to-embed-python-in-an-objective-c-os-x-application-for-plugins
download the source tarball desired from Python.org
Create a build directory with no spaces, because #! don't work with space, /Users/me/Projects/PythonHost
extract the python tarball resulting in e.g. /Users/me/Projects/PythonHost/Python-3.7.7
download openssl-1.1.1g.tar.gz from openssl.org, similarly, extract to /Users/me/Projects/PythonHost/openssl-1.1.g
cd into that directory and:
./config
make
sudo make install
cd into the Python-3.7.7 directory, and
./configure --prefix=/Users/me/Projects/PythonHost/python-3.7.7-dev
make -j4
make install
lzma and tkinter, as well as ssl fail to build. Not a problem, probably.
make sure the python environment is viable by setting the PYTHONPATH
export PYTHONPATH="/Users/me/Projects/PythonHost/python-3.7.7-dev/lib/python3.7/site-packages/"
AND pip doesn't work because the ssl module failed to build.