0

I have installed Anaconda on my server.
However, when I setup a cron job to schedule a script, it uses the default python installed on the system.

How do I use the Anaconda version?

This is my current cron job:

01 00 * * * python /home/ubuntu/data_scripts/test.py
Kromster
  • 7,181
  • 7
  • 63
  • 111
scalauser
  • 449
  • 1
  • 12
  • 23
  • This possibly has more answers at https://stackoverflow.com/questions/36365801/run-a-crontab-job-using-an-anaconda-env even though it's newer – sappjw Aug 23 '23 at 14:08

1 Answers1

1

If you know the installed path, you can define your python path to your crontab.

For example, if the installed path is /usr/bin/python or /usr/bin/python3 your crontab would look like this:

01 00 * * * /usr/bin/python /home/ubuntu/data_scripts/test.py  
01 00 * * * /usr/bin/python3 /home/ubuntu/data_scripts/test.py 

Note: As @asmeurer mentioned, if you are using ubuntu your installed path probably will look more like this /home/ubuntu/anaconda/bin/python

Community
  • 1
  • 1
michael_stackof
  • 223
  • 3
  • 12