php exec python script that imports numpy
问题 I need a php script to execute a python script. Now the python code looks like this: test.py import sys try: import numpy print 'Numpy was loaded' except: print 'Could not Load Numpy' All the following commands print 'Numpy was loaded': $python test.py $python2.7 test.py PHP Script: exec('python test.py',$output,$ret); var_dump($output); The PHP script works if the line 'import numpy' is removed. I have tried the following things: Use absolute path in php script : exec("/usr/bin/python /home