AttributeError: ‘bytes‘ object has no attribute ‘encode‘

问题描述

报错:AttributeError: 'bytes' object has no attribute 'encode'

  File "S:\physon\envs\tensorflow\lib\site-packages\keras\engine\saving.py", line 377, in <listcomp>
    n.encode('utf-8').decode('utf-8') for n in
AttributeError: 'bytes' object has no attribute 'encode'

使用conda list查看依赖
在这里插入图片描述

原因分析:

keras与h5py版本不兼容:

由于之前跑另一个模型将号h5py版本从3.10换到了2.10,现在换了个模型就报错,只能再换回去


解决方案:

更换原来的h5py版本:

pip install h5py==3.1.0

猜你喜欢

转载自blog.csdn.net/weixin_45913922/article/details/124013011