Unable to open file (unable to open file: name = './model/char_judgement.h5', er

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-29 15:42   19   0

一、问题

  1. PHP调用Python报错:
    : Unable to open file (unable to open file: name = './model/char_judgement.h5', errno = 2, error message = 'No such file or directory'
  2. 但CMD直接运行Python没有错误

二、原因

PHP调用Python需要使用绝对路径,不能使用相对路径

三、解决

将Python中的所有相对路径改为绝对路径

四、思考

  1. 降低Python程序对不用平台的适应性,增加调试难度;
  2. 后期考虑去掉PHP,直接使用Flask或者使用绝对路径作为变量进行传递,可以在一定程度上解决问题
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP