当前位置:网站首页>【错误】加载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 8a数据库学习的感悟
- The usage of rand function in MATLAB
- Get familiar with XML parsing quickly
- Remote Sensing投稿经验分享
- AttributeError: ‘str‘ object has no attribute ‘strftime‘
- 能力贡献 GBASE三大解决方案入选“金融信创生态实验室-金融信创解决方案(第一批)”
- PHP 计算个人所得税
- C语言-模块化-Clion(静态库,动态库)使用
- Js中forEach map无法跳出循环问题以及forEach会不会修改原数组
- Android 创建的sqlite3数据存放位置
猜你喜欢
Working principle of stm32gpio port
Sword finger offer II 041 Average value of sliding window
How to make the conductive slip ring signal better
【目标跟踪】|atom
能力贡献 GBASE三大解决方案入选“金融信创生态实验室-金融信创解决方案(第一批)”
pb9.0 insert ole control 错误的修复工具
Graphic network: uncover the principle behind TCP's four waves, combined with the example of boyfriend and girlfriend breaking up, which is easy to understand
break net
如何让导电滑环信号更好
生态 | 湖仓一体的优选:GBase 8a MPP + XEOS
随机推荐
What kind of MES system is a good system
Summary of log feature selection (based on Tianchi competition)
Kafka connect synchronizes Kafka data to MySQL
保姆级教程:Azkaban执行jar包(带测试样例及结果)
Optimization of ecological | Lake Warehouse Integration: gbase 8A MPP + xeos
能力贡献 GBASE三大解决方案入选“金融信创生态实验室-金融信创解决方案(第一批)”
The numerical value of the number of figures thought of by the real-time update of the ranking list
WPF 自定义 写实风 雷达图控件
Anaconda3 download address Tsinghua University open source software mirror station
The persistence mode of redis - RDB and AOF persistence mechanisms
如果时间是条河
PHP 计算个人所得税
Chapter 7 behavior level modeling
从cmath文件看名字是怎样被添加到命名空间std中的
The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
Graphic network: uncover the principle behind TCP's four waves, combined with the example of boyfriend and girlfriend breaking up, which is easy to understand
3. Multi agent reinforcement learning
qt--将程序打包--不要安装qt-可以直接运行
C language - modularization -clion (static library, dynamic library) use
The method of using thread in PowerBuilder