UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 198: illegal multibyte sequence
Posted AI浩
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 198: illegal multibyte sequence相关的知识,希望对你有一定的参考价值。
问题描述
在做YoloV5剪枝的时候,遇到如下问题;
return load(stream, SafeLoader)
File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\yaml\\__init__.py", line 79, in load
loader = Loader(stream)
File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\yaml\\loader.py", line 34, in __init__
Reader.__init__(self, stream)
File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\yaml\\reader.py", line 85, in __init__
self.determine_encoding()
File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\yaml\\reader.py", line 124, in determine_encoding
self.update_raw()
File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\yaml\\reader.py", line 178, in update_raw
data = self.stream.read(size)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 198: illegal multibyte sequence
读取data的yaml文件遇到了无法解析的字符。
原因分析
新版本的YoloV5,在yaml文件里有个小火箭的图标
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
把这个删除掉就可以了
以上是关于UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 198: illegal multibyte sequence的主要内容,如果未能解决你的问题,请参考以下文章
python编码问题:UnicodeDecodeError: 'gbk' codec can't decode
Python3文本编码错误:UnicodeDecodeError: 'gbk' codec can't decode byte
python读取文件时UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte
Python_报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal
python 读取文件时报错: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 127:
python报错:UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xb4