更新时间:2023-12-05 17:16:04
您不需要在 Python 脚本中设置 PATH.相反,把类似的东西
You shouldn't need to set the PATH from within the python script. Instead, put something like
USER=joe
HOME=/home/joe
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/some/other/path
PYTHONPATH=/home/joe/pybin
MAILTO=joe
LANG=en_US.UTF-8
#min hr day mon dow
*/5 12 * * * reminder.py 'Eat lunch'
在你的 crontab 的顶部.然后,这些环境变量将可用于通过您的 crontab 运行的所有 cron 作业.
at the top of your crontab. These environment variables will then be available to all cron jobs run through your crontab.