简体   繁体   English

在/ var / www / html目录中的php中执行python代码

[英]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.

相关问题 var / www / html目录的权限 - permission for var/www/html directory 通过cronjob执行PHP脚本-脚本中未读取到/ var / www / html /目录中数据目录的路径 - Executing PHP script by cronjob - A path to a data directory in /var/www/html/ directory is not being read in the script 存储html的php变量内的get_template_directory_uri() - get_template_directory_uri() inside a php var that stores html apache php javascript-无法打开流:/ var / www / html / bla中没有此类文件或目录 - apache php javascript - Failed to open stream: No such file or directory in /var/www/html/bla 警告:require_once(/var/www/html/wp-config.php):无法打开流:没有这样的文件或目录 - Warning: require_once(/var/www/html/wp-config.php): failed to open stream: No such file or directory require_once(/var/www/html/presta/var/cache/prod/appParameters.php):无法打开流:没有这样的文件或目录 - require_once(/var/www/html/presta/var/cache/prod/appParameters.php): failed to open stream: No such file or directory 在HTML select中执行PHP代码 - Execute PHP code inside HTML select 在默认 var/www/html 文件夹内的实时服务器中,如果没有 index.php,codeigniter 路由将无法工作 - codeigniter routes not working without index.php in live server inside default var/www/html folder AH01276:无法提供目录/ var / www / html /:找不到匹配的DirectoryIndex(index.php,index.html) - AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found 无法提供目录/ var / www / html / public / [Laravel-AWS Elasticbeanstalk] - Cannot serve directory /var/www/html/public/ [Laravel - Aws Elasticbeanstalk]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM