sh: 1: python: not found when execute python script from php

I'm tring to execute a python script call from php with the command below:

$output = shell_exec('python /var/www/html/sna/server/userManagement.py '. $user.' '. $pass .' \''.$action.'\' 2>&1');

But when I execute it I get this

sh: 1: python: not found 

But python is correctly installed in my env.

If I digit

type -a python 

I get the path of python in this env like below

python is /home/leonardo/miniconda2/envs/sna/bin/python

At the very beginning of the python script I have include

#!/usr/bin/env python

But I recieve always the same error. How can I solve ?

2

1 Answer

Taking the comment of @Anonymous:

Call Python providing the full path (in your virtual environment).

PS: A comment is not an answer. If you search, this question without an answer is less interesting, although it has the answer in its comments. That is why I copied it. All credits go to the other user.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like