当前位置:网站首页>【错误】加载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
边栏推荐
- 什么样的MES系统才是好系统
- Gbase observation | how to protect the security of information system with frequent data leakage
- Understanding of expectation, variance, covariance and correlation coefficient
- qt--将程序打包--不要安装qt-可以直接运行
- About snake equation (5)
- 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!!!
- 【目标跟踪】|atom
- QML fonts use pixelsize to adapt to the interface
- PHP to get information such as audio duration
- 给刚入门或者准备转行网络工程师的朋友一些建议
猜你喜欢

从cmath文件看名字是怎样被添加到命名空间std中的

How to fix the slip ring

C language - modularization -clion (static library, dynamic library) use

静态路由配置全面详解,静态路由快速入门指南

nacos-微服务网关Gateway组件 +Swagger2接口生成

About snake equation (5)

About snake equation (3)

Js中forEach map无法跳出循环问题以及forEach会不会修改原数组

剑指 Offer II 041. 滑动窗口的平均值

城市土地利用分布数据/城市功能区划分布数据/城市poi感兴趣点/植被类型分布
随机推荐
静态路由配置全面详解,静态路由快速入门指南
QT build with built-in application framework -- Hello World -- use min GW 32bit
common commands
DataWorks值班表
Working principle of stm32gpio port
如果时间是条河
快速熟知XML解析
After modifying the background of jupyter notebook and adding jupyterthemes, enter 'JT -l' and the error 'JT' is not an internal or external command, nor a runnable program
批次管控如何实现?MES系统给您答案
ROS problems (topic types do not match, topic datatype/md5sum not match, MSG XXX have changed. rerun cmake)
Application of slip ring in direct drive motor rotor
powerbuilder 中使用线程的方法
如何制作企业招聘二维码?
Understanding of prior probability, posterior probability and Bayesian formula
Euler Lagrange equation
Chapter 7 behavior level modeling
子矩阵的和
Codeforces Round #649 (Div. 2)——A. XXXXX
【目标跟踪】|DiMP: Learning Discriminative Model Prediction for Tracking
Get familiar with XML parsing quickly