Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to run pipenv in cronjob in ubuntu?

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

like image 213
beehuang Avatar asked Dec 19 '22 01:12

beehuang


1 Answers

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

like image 166
Varad Avatar answered Dec 27 '22 02:12

Varad