当前位置:网站首页>【错误】加载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
边栏推荐
- Introduction to grpc for cloud native application development
- break net
- The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
- Sum of submatrix
- Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
- Voice of users | understanding of gbase 8A database learning
- qt--将程序打包--不要安装qt-可以直接运行
- WPF 自定义 写实风 雷达图控件
- 剑指 Offer II 041. 滑动窗口的平均值
- How does Matplotlib generate multiple pictures in turn & only save these pictures without displaying them in the compiler
猜你喜欢
About snake equation (1)
Remote sensing contribution experience sharing
The difference between distribution function and probability density function of random variables
能力贡献 GBASE三大解决方案入选“金融信创生态实验室-金融信创解决方案(第一批)”
Matlab code about cosine similarity
给刚入门或者准备转行网络工程师的朋友一些建议
Problems of font legend and time scale display of MATLAB drawing coordinate axis
C language - modularization -clion (static library, dynamic library) use
PB9.0 insert OLE control error repair tool
保姆级教程:Azkaban执行jar包(带测试样例及结果)
随机推荐
Mysql database (2)
【目标跟踪】|DiMP: Learning Discriminative Model Prediction for Tracking
ROS 问题(topic types do not match、topic datatype/md5sum not match、msg xxx have changed. rerun cmake)
About snake equation (5)
Dataworks duty table
The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
Usage of hydraulic rotary joint
Get familiar with XML parsing quickly
NPM internal split module
NPDP在国内有认可度吗?看一看就明白了!
GBASE观察 | 数据泄露频发 信息系统安全应如何守护
PB9.0 insert OLE control error repair tool
Js中forEach map无法跳出循环问题以及forEach会不会修改原数组
Kafka connect synchronizes Kafka data to MySQL
Application of slip ring in direct drive motor rotor
About snake equation (3)
SQLite3 data storage location created by Android
云原生应用开发之 gRPC 入门
How to make the conductive slip ring signal better
break algorithm---刷题map