Feb-03-2022, 11:06 PM
The PATH doesn't seem that big a deal, both accounts are running "/usr/bin/python3.9". But the import path is different. The "pi" account has a .local site-packages that root isn't accessing.
I suppose something might be setting PYTHONPATH in your environment, but not in root.
Some options for you:
* Does it need to run as root? Could you put it in the "pi" user's crontab instead?
* Add "/home/pi/.local/lib/python3.9/site-packages" to PYTHONPATH in the root environment
(You could also have root install cv2 separately, but then you'd have two copies and a chance that they're not the same version. Better to keep one copy).
I suppose something might be setting PYTHONPATH in your environment, but not in root.
Some options for you:
* Does it need to run as root? Could you put it in the "pi" user's crontab instead?
* Add "/home/pi/.local/lib/python3.9/site-packages" to PYTHONPATH in the root environment
(You could also have root install cv2 separately, but then you'd have two copies and a chance that they're not the same version. Better to keep one copy).