Reputation: 369
I have installed pipenv by pip3.
And it works pipenv -h in script.
But after in crontab, it's not work.
pip3 show pipenv
Location: /home/ubuntu/.local/lib/python3.6/site-packages
my cronjob
21 * * * * cd /home/ubuntu/test; /bin/sh test.sh > /home/ubuntu/test.out 2>&1
test.sh
#!/bin/bash
echo "hi"
python -V
python3 -V
pipenv -h
output
hi
Python 2.7.12
Python 3.6.3
test.sh: : test.sh: pipenv: not found
how to run pipenv in cronjob in ubuntu? thanks.
Answer:
/home/ubuntu/.local/bin/pipen
Upvotes: 9
Views: 5228
Reputation: 2123
Exmaple:
20 * * * * bash -lc mypythonscript
This will bring in your paths defined in your bashrc/profile etc
Upvotes: 1
Reputation: 1022
Try giving the whole path.
Find which pipenv and then run with the absolute path of the same. instead of pipenv -h
In my case it was located in /usr/local/bin/pipenv
Upvotes: 19