当前位置:网站首页>Solution: attributeerror: 'STR' object has no attribute 'decode‘
Solution: attributeerror: 'STR' object has no attribute 'decode‘
2022-07-06 02:36:00 【Grasp*】
Catalog
1 Introduction to the environment
1 Introduction to the environment
Deep learning framework version and corresponding python The environment version is as follows :
TensorFlow2.1.0+keras2.3.1+python36
2 Error message :
File "D:\Python36\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "D:\Python36\lib\site-packages\keras\engine\saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "D:\Python36\lib\site-packages\keras\engine\saving.py", line 273, in _deserialize_model
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
3 Problem analysis
In the above environment , load .h5 Deep learning model , The error that the message character cannot be decoded , The probability is that a package version is incompatible . What exactly is incompatible , You can see this sentence from the error message :
model = _deserialize_model(h5dict, custom_objects, compile)Current environment pair h5 There is a problem that deserialization cannot be carried out when processing files , Search for information and find :

When we install tensorflow2.1.0 When , It will be automatically installed for us h5py The version is 3.1.0. However tensorflow2.1.0 Support h5py<3.0.0, This is the root cause of the above error report .
4 Problem finding
Search online :

Click in the first

Found a lot of support python3.6 After h5py edition , Which one to use ?
Search further :

Find many corresponding , Just click in to find your corresponding version . The above just shows the way to find the answer , For no other purpose .
5 Final solution
First uninstall the original h5py-3.1.0

Then install the matching h5py edition

Finally complete the installation

Open the settings and have a look

Installation successful !
I hope it will be useful to the students I see ~
There is another error in the installation process , If there is a solution , Welcome to leave a message ~
边栏推荐
- 力扣今日题-729. 我的日程安排表 I
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 16
- 剑指 Offer 29. 顺时针打印矩阵
- Keyword static
- Global and Chinese market of commercial cheese crushers 2022-2028: Research Report on technology, participants, trends, market size and share
- Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
- Sword finger offer 29 Print matrix clockwise
- Paper notes: limit multi label learning galaxc (temporarily stored, not finished)
- SSM 程序集
- 力扣今日題-729. 我的日程安排錶 I
猜你喜欢
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19](/img/7c/f728e88ca36524f92c56213370399b.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19

How to generate rich text online

好用的 JS 脚本

一个复制也能玩出花来

Sword finger offer 30 Stack containing min function

QT release exe software and modify exe application icon
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7](/img/44/1861f9016e959ed7c568721dd892db.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7

2022 eye health exhibition, vision rehabilitation exhibition, optometry equipment exhibition, eye care products exhibition, eye mask Exhibition

Force buckle 146 LRU cache

技术管理进阶——什么是管理者之体力、脑力、心力
随机推荐
在GBase 8c数据库中使用自带工具检查健康状态时,需要注意什么?
Li Kou today's question -729 My schedule I
Sword finger offer 30 Stack containing min function
HttpRunnerManager安装(三)-Linux下配置myql数据库&初始化数据
【MySQL 15】Could not increase number of max_ open_ files to more than 10000 (request: 65535)
Minecraft 1.16.5 biochemical 8 module version 2.0 storybook + more guns
DDoS "fire drill" service urges companies to be prepared
JS events (add, delete) and delegates
Template_ Find the reverse pair of permutations_ Sort based on merge
[postgraduate entrance examination English] prepare for 2023, learn list5 words
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
构建库函数的雏形——参照野火的手册
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
Template_ Quick sort_ Double pointer
[community personas] exclusive interview with Ma Longwei: the wheel is not easy to use, so make it yourself!
Paper notes: limit multi label learning galaxc (temporarily stored, not finished)
数据准备工作
QT release exe software and modify exe application icon
[coppeliasim] 6-DOF path planning
Spherical lens and cylindrical lens