[英]Execute python code inside php in /var/www/html directory
Error coming when running a python code which is using tensorflow , inside the php code. 在php代码内部运行使用tensorflow的python代码时出现错误。 Error is :-
错误是:-
Traceback (most recent call last):
File "Loader.py", line 5, in import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 48, in from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in _pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Few lines of Python code in which trying to execute the python code are:- 尝试执行python代码的几行Python代码是:-
$temp = shell_exec('python Loader.py 2>&1') or die('cannot run Loader.py') ;
echo $temp;
Create a new virtual environment. 创建一个新的虚拟环境。 Install your dependencies and then run your code.
安装您的依赖项,然后运行您的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.