Crontab not executing a Python script?

前端 未结 15 1547
囚心锁ツ
囚心锁ツ 2020-11-29 20:42

My python script is not running under my crontab.

I have placed this in the python script at the top:

#!/usr/bin/python

I hav

15条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 20:53

    Easiest way to handle this is to add your python installation's path to PATH in top of the shell script. Something like:

    #!/usr/bin/env bash
    export PATH="{path to your python installation}:$PATH"
    python {python_file_name}.py
    

    As @Shargors said you can test it by

    env -i /bin/bash --noprofile --norc
    

提交回复
热议问题