I am trying to execute a cronjob on MacOS and it seems that whenever it executes, it uses an older version of Python.
I created a .sh file that would execute the following command:
#!/bin/bash
python3 --version
/usr/bin/python3 /Users/mymacos/Documents/OrderTracker/gve_devnet_ccw_order_delivery_date_tracker/src/ccwquery.py
Whenever I do, python3 –version on terminal, my Python verison is the following:
Python 3.12.3
But whenever the cronjob .sh execute, I see that in the cron that the Python version is
Python 3.9.6
Here is a dump of my local bin
$ ls -l /usr/local/bin/python*
lrwxr-xr-x 1 mymacos admin 25 1 Jun 06:39 /usr/local/bin/python -> /usr/local/bin/python3.12
lrwxr-xr-x 1 root wheel 70 31 May 14:52 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3
lrwxr-xr-x 1 root wheel 77 31 May 14:52 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-config
lrwxr-xr-x 1 root wheel 78 31 May 14:52 /usr/local/bin/python3-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-intel64
lrwxr-xr-x 1 root wheel 73 31 May 14:52 /usr/local/bin/python3.12 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
lrwxr-xr-x 1 root wheel 80 31 May 14:52 /usr/local/bin/python3.12-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-config
lrwxr-xr-x 1 root wheel 81 31 May 14:52 /usr/local/bin/python3.12-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-intel64
lrwxr-xr-x 1 mymacos admin 25 31 May 14:59 /usr/local/bin/python3.9 -> /usr/local/bin/python3.12
Any idea on how to make my cron always execute the system Python version, i.e Python 3.12.3?
Thank you!
I created a .sh file that would execute the following command:
#!/bin/bash
python3 --version
/usr/bin/python3 /Users/mymacos/Documents/OrderTracker/gve_devnet_ccw_order_delivery_date_tracker/src/ccwquery.py
Whenever I do, python3 –version on terminal, my Python verison is the following:
Python 3.12.3
But whenever the cronjob .sh execute, I see that in the cron that the Python version is
Python 3.9.6
Here is a dump of my local bin
$ ls -l /usr/local/bin/python*
lrwxr-xr-x 1 mymacos admin 25 1 Jun 06:39 /usr/local/bin/python -> /usr/local/bin/python3.12
lrwxr-xr-x 1 root wheel 70 31 May 14:52 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3
lrwxr-xr-x 1 root wheel 77 31 May 14:52 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-config
lrwxr-xr-x 1 root wheel 78 31 May 14:52 /usr/local/bin/python3-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-intel64
lrwxr-xr-x 1 root wheel 73 31 May 14:52 /usr/local/bin/python3.12 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
lrwxr-xr-x 1 root wheel 80 31 May 14:52 /usr/local/bin/python3.12-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-config
lrwxr-xr-x 1 root wheel 81 31 May 14:52 /usr/local/bin/python3.12-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-intel64
lrwxr-xr-x 1 mymacos admin 25 31 May 14:59 /usr/local/bin/python3.9 -> /usr/local/bin/python3.12
smyssw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.