I have a python script that I want to use with a KM trigger. Given a book's ISBN in the clipboard, the script download the book metadata from Google with the ISBN and generates an APA citation in markdown format.
pyenv so I can have a python environment separate from the built-in macOS version of python3. Following these instructions for setting up a separate python environment on macOS, I created a shim in my
.zshrc file so my
pyenv version of python gets launched instead of the built-in one.
That allows me to use
#!/bin/env python3 in my scripts, but it doesn't work from KM because, as I understand it, the shell KM launches doesn't know anything about the shim. As a result, none of the python libraries I have installed inside my virtual python environment are available. I can make it work if I specify the full path to my virtualized python instance using
at the top of my python script, but this affects maintainability of the script since I could upgrade my python version at any time.
What's the best way to give my KM macro the additional context it needs to execute the shimmed version of python when running the script?