开源框架运行报错:str object has no attribute decode,解决方法

多数人都会在配置开源框架运行报错:str object has no attribute decode,极其头疼。。。

我是在配置 MaskR-CNN 的时候遇到这个问题,在下图这个加载预训练模型的时候报错:str object has no attribute decode。

经多方百度排查后发现是 h5py 模块版本过高。(报错时我的版本是3.10)
在这里插入图片描述

解决方法:卸载现有版本再安装一个低版本的h5py即可。

卸载:

pip uninstall h5py

重新安装低版本的:
(卸载不了就直接运行这个,源如果没更改的话,建议加上国内源)

pip install h5py==2.10 -i https://pypi.tuna.tsinghua.edu.cn/simple/

之前我配置 yolov3、yolov5 时也出现过这个错误,解决方法同上。

猜你喜欢

转载自blog.csdn.net/weixin_44414948/article/details/114903215