AttributeError: 'str' object has no attribute 'decode'


Traceback (most recent call last):
  File "rain800_test.py", line 72, in <module>
    main()
  File "rain800_test.py", line 44, in main
    model.load_weights(weight_file)
  File "/root/anaconda3/envs/tensorflow_x/lib/python3.6/site-packages/keras/engine/network.py", line 1166, in load_weights
    f, self.layers, reshape=reshape)
  File "/root/anaconda3/envs/tensorflow_x/lib/python3.6/site-packages/keras/engine/saving.py", line 1004, in load_weights_from_hdf5_group
    original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'

解决办法:
卸载原来的h5py模块,安装2.10版本

pip install h5py==2.10 -i

自问自答了??