Need Help Running Python Shell Script from KM

Python has changed the rules - you should create so named "virtual environment" for this solution (aka project), install required packages, test and later run activating venv in KM

Assuming that you have installed python (I suggest install from homebrew) and it is reachable in terminal session, it may looks like below

# create place for project and required packages 
mkdir -p ~/projects/pyvenvs/pyperclip
cd ~/projects/pyvenvs/pyperclip
# create virtual environment in subdirectory venv 
python3 -m venv venv
# activate virtual environment for install required packages
. venv/bin/activate
# install required packages and their dependencies
pip install paperclip
# below test is module available
python3 
>>>import pyperclip. # <-- if no error - module is available
>>>quit
# deactivate interactive virtual environment
deactivate 
# the project is ready to work

After preparing you may activate this virtual environment for script by pointing in the python interpreter inside virtual environment like (in KM execute shell script):

/Users/user/projects/pyvenvs/pyperclip/venv/bin/python3 <<EOF
import pyperclip
print(dir(pyperclip))
EOF

If package will change - have f.ex. new version repeat steps activate; pip update; deactivate