Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell script : Getting python: command not found error

When I call Python script from shell script, it runs fine.

python script.py

But after I pulled the same script from Gerrit and then added code for calling Python script, then it gave me the below error :

./script.sh: line 126: python: command not found
like image 299
Saili Gaitonde Avatar asked Oct 31 '25 01:10

Saili Gaitonde


1 Answers

Looks like path problem.

Use which python in terminal to find your python path first. In my case it's in /usr/bin

$ which python
/usr/bin/python

Then add the python path to path variable in your script.sh, e.g. put the following line in any place before you call python.

PATH+=:/usr/bin
like image 151
Taylor G. Avatar answered Nov 01 '25 17:11

Taylor G.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!