Tensorflow/Keras/h5py报错处理

个人经历记录贴,若有侵请联系我谢谢。

Python/Tensorflow/Keras版本对应

按理说Tensorflow 2.x已经集成了Keras 如果有报错可能需要检查一下版本对应。
关于h5py,Tensorflow2.1 不支持 h5py >= 3.0.0。
可参考我所用的版本对应:
Python 3.7(conda) + Tensorflow 2.1.0 + Keras 2.3.0 + h5py 2.10.0
在这里插入图片描述

AttributeError: module ‘h5py’ has no attribute ‘File’

重装h5py库。使用conda环境的话在python命令行里:

pip uninstall h5py

conda install h5py

非conda环境:

pip uninstall h5py

pip install h5py

AttributeError: ‘str’ object has no attribute ‘decode’

model_config = json.loads(model_config.decode(‘utf-8’))AttributeError: ‘str’

解决方法同上。h5py版本对应问题。

===不定期更新


版权声明:本文为AsmallFROG原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。