当前位置:网站首页>【错误】加载h5权重出错AttributeError: ‘str‘ object has no attribute ‘decode‘
【错误】加载h5权重出错AttributeError: ‘str‘ object has no attribute ‘decode‘
2022-07-08 00:25:00 【there2belief】
问题
tensorflow在python3.7环境加载python3.6环境的h5权重时出错
AttributeError: 'str' object has no attribute 'decode'
解决思路
根据问题提示,意思是,属性错误:“str”对象没有属性“decode”
网上出现该问题多是python3和2的差异导致
例如:python3.5和Python2.7在套接字返回值解码上的区别
python在bytes和str两种类型转换,所需要的函数依次是encode(),decode()
笔者是出现在python3.7与python3.6
解决方法
T1、直接去掉
直接去掉decode('utf8')tips:str通过encode()方法可以编码为指定的bytes。反过来,当从网络或磁盘上读取了字节流,那么读到的数据就是bytes。要把bytes变为str,就需要用decode()方法。反之,则使用encode()方法即可!
T2、众多网友好评的建议
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
边栏推荐
- 能力贡献 GBASE三大解决方案入选“金融信创生态实验室-金融信创解决方案(第一批)”
- Matlab method is good~
- Codeforces Round #649 (Div. 2)——A. XXXXX
- Break algorithm --- map
- 什么样的MES系统才是好系统
- Sword finger offer II 041 Average value of sliding window
- 如何让导电滑环信号更好
- Understanding of expectation, variance, covariance and correlation coefficient
- About snake equation (5)
- 2、TD+Learning
猜你喜欢
How to make the conductive slip ring signal better
Android 创建的sqlite3数据存放位置
滑环使用如何固定
Introduction to grpc for cloud native application development
In depth analysis of ArrayList source code, from the most basic capacity expansion principle, to the magic iterator and fast fail mechanism, you have everything you want!!!
Remote sensing contribution experience sharing
如何让导电滑环信号更好
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
Capability contribution three solutions of gbase were selected into the "financial information innovation ecological laboratory - financial information innovation solutions (the first batch)"
COMSOL----微阻梁模型的搭建---最终的温度分布和变形情况---材料的添加
随机推荐
小金额炒股,在手机上开户安全吗?
Different methods for setting headers of different pages in word (the same for footer and page number)
【目标跟踪】|atom
MATLAB R2021b 安装libsvm
Codeforces Round #643 (Div. 2)——B. Young Explorers
cv2-drawline
用户之声 | 冬去春来,静待花开 ——浅谈GBase 8a学习感悟
MySQL查询为什么没走索引?这篇文章带你全面解析
The persistence mode of redis - RDB and AOF persistence mechanisms
common commands
Capability contribution three solutions of gbase were selected into the "financial information innovation ecological laboratory - financial information innovation solutions (the first batch)"
Sum of submatrix
静态路由配置全面详解,静态路由快速入门指南
Voice of users | understanding of gbase 8A database learning
Codeforces Round #633 (Div. 2) B. Sorted Adjacent Differences
ArrayList源码深度剖析,从最基本的扩容原理,到魔幻的迭代器和fast-fail机制,你想要的这都有!!!
Summary of log feature selection (based on Tianchi competition)
How to make the conductive slip ring signal better
Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
npm 內部拆分模塊