Shell script : Getting python: command not found error

Viewed 5588

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
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
Related