改善
Kaizen  · Today I Learned by Ville Säävuori

Installing Python With Shared Library on macOS

I needed a Python version with shared library in order to use PyO3 to run Python in Tauri to fix this error: “error: The auto-initialize feature is enabled, but your python installation only supports embedding the Python interpreter statically. If you are attempting to run tests, or a binary which is okay to link dynamically, install a Python distribution which ships with the Python shared library.”

Installing one with pyenv was trivial: env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.10.6

In addition to the properly built python I needed to instruct PyO3 to use the correct Python version with an env variable: export PYO3_PYTHON=/Users/uninen/.pyenv/versions/3.10.6/bin/python