I knew nothing about
environ path when I started to learn programming languages. It took me a long time to understand the
I'll try to describe how I understand it.
When we use a command in the terminal, say
python3 /path/to/file.py. On the mac, if the default language is
zsh has to know where
interpreter) is and asks it to execute the scripts.
When we run
which python3, if
python3 is installed and
zsh knows where it is, the
which python3 command will return the
python3, something like
python3 is installed but
zsh does not know it, then you will have to know where does
zsh searches for
environ path comes in.
If we run
echo $PATH in the terminal, we will get a serial of
directories separated by
zsh search search these directories, looking for
python3, if it finds it, then it will ask
python3 to run the script. (if you have multiple python3 interpreters, the first that is found will be used as the interpreter. Therefore, the order of the directories matters). Otherwise, it will say that the interpreter is lacking. We will have to add the path to python3 to it by editing a file named
When we run python scripts in Keyboard Maestro, we are not in the Terminal anymore. Therefore, the
.zshrc file is irrelevant. We have to let Keyboard Maestro know where the python3 interpreter is. We do this by creating a Keyboard Maestro variable called
ENV_PATH. Keyboard Maestro will search through these directories and look for
ENV_PATH is properly set, we can use
in the Shell Script action to run the script.
ENV_PATH is not set, we have to use the full path to python3 instead of
python3, that is, we have to use something like: