我在通过php执行tensorflow程序时遇到了一些问题。 我想执行基于张量流的程序“ Luminoth”。 这是我执行的python文件script.py:
import subprocess
subprocess.call(["sudo", "python", "/usr/local/bin/lumi", "predict", "/var/www/html/image1.jpg", "--checkpoint", "instruments", "-f", "/var/www/html/objects.json", "-d", "/var/www/html/"])
当我这样做时,php echo表示:
blubstdout : string(0) "" stderr : string(171) "Luminoth requires a TensorFlow >= 1.5 installation. Depending on your use case, you should install either
张量流or
张量流gpu packages manually or via PyPI. " done
当我使用shell脚本script.sh而不是script.py
时,情况相同 #!/bin/bash
/usr/local/bin/lumi predict /var/www/html/pictures/image1.jpg --checkpoint instruments /var/www/html//pictures/predictions/objects.json -d /var/www/html/pictures/predictions/
在python脚本中,我尝试在前面设置导入import tensorflow
或import tensorflow as tf
。那么回声是:
blubstdout : string(0) "" stderr : string(384) "Traceback (most recent call last): File "script.py", line 1, in import tensorflow File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in from tensorflow.python import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 47, in import numpy as np ImportError: No module named numpy " done
当我添加import numpy
时说:
blubstdout : string(0) "" stderr : string(127) "Traceback (most recent call last): File "script.py", line 1, in import numpy ImportError: No module named numpy " done
但是我之前安装了numpy
sudo apt-get install python3-numpy
您有解决此问题的想法吗?
非常感谢,祝您有美好的一天!