当前位置:网站首页>【错误】加载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
边栏推荐
- 给刚入门或者准备转行网络工程师的朋友一些建议
- WPF 自定义 写实风 雷达图控件
- ROS problems (topic types do not match, topic datatype/md5sum not match, MSG XXX have changed. rerun cmake)
- Problems of font legend and time scale display of MATLAB drawing coordinate axis
- Scalar / vector / matrix derivation method
- Working principle of stm32gpio port
- 用户之声 | 对于GBase 8a数据库学习的感悟
- 从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
- C语言-Cmake-CMakeLists.txt教程
- How does Matplotlib and PIL image integrate and save multiple pictures into one picture
猜你喜欢

【目标跟踪】|atom

生态 | 湖仓一体的优选:GBase 8a MPP + XEOS

Voice of users | winter goes and spring comes, waiting for flowers to bloom -- on gbase 8A learning comprehension

Summary of log feature selection (based on Tianchi competition)

Android 创建的sqlite3数据存放位置

About snake equation (5)

MATLAB R2021b 安装libsvm

How to fix the slip ring

Different methods for setting headers of different pages in word (the same for footer and page number)

QT build with built-in application framework -- Hello World -- use min GW 32bit
随机推荐
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!!!
用户之声 | 对于GBase 8a数据库学习的感悟
How to make the conductive slip ring signal better
NPM internal split module
Redis cluster
qt--将程序打包--不要安装qt-可以直接运行
The function of carbon brush slip ring in generator
Qt - - Packaging Programs - - Don't install Qt - can run directly
C language - modularization -clion (static library, dynamic library) use
快速熟知XML解析
How to fix the slip ring
由排行榜实时更新想到的数状数值
NPM Internal Split module
COMSOL----微阻梁模型的搭建---最终的温度分布和变形情况----几何模型的建立
MySQL数据库(2)
Codeforces Round #649 (Div. 2)——A. XXXXX
ROS problems (topic types do not match, topic datatype/md5sum not match, MSG XXX have changed. rerun cmake)
Remote Sensing投稿经验分享
[SolidWorks] modify the drawing format
How does Matplotlib and PIL image integrate and save multiple pictures into one picture