当前位置:网站首页>[error] error loading H5 weight attributeerror: 'STR' object has no attribute 'decode‘

[error] error loading H5 weight attributeerror: 'STR' object has no attribute 'decode‘

2022-07-08 01:52:00 there2belief

problem

tensorflow stay python3.7 Environment loading python3.6 Environmental h5 Error in weight
AttributeError: 'str' object has no attribute 'decode'

Solutions

According to the question , intend , Property error :“str” Object has no properties “decode”

Most of the problems on the Internet are python3 and 2 The difference between

for example :python3.5 and Python2.7 The difference in socket return value decoding  

python stay bytes and str Two types of conversion , The required functions are encode(),decode()

The author appeared in python3.7 And python3.6

resolvent

T1、 Directly remove
Directly remove decode('utf8')

tips:str adopt encode() Methods can be encoded as specified bytes. In turn, , When the byte stream is read from the network or disk , So the data you read is bytes. To put bytes Turn into str, It needs to be used. decode() Method . conversely , Then use encode() The method can !

T2、 Suggestions highly praised by many netizens
pip install 'h5py<3.0.0' -i https://pypi.tuna.tsinghua.edu.cn/simple


————————————————
Thanks to:https://blog.csdn.net/qq_41185868/article/details/82079079

原网站

版权声明
本文为[there2belief]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/189/202207080025056057.html