'gbk' codec can't decode byte 0x80 in position 64: illegal multibyte sequence
时间: 2023-08-12 08:06:26 浏览: 96
这个报错是由于使用了错误的编码格式导致的。根据引用\[1\]中的解决方法,你可以在使用`open()`方法打开文件时指定编码格式为utf-8来解决这个问题。例如:
```python
with open(file_path, 'r', encoding='utf-8') as f:
# 读取文件内容
```
另外,根据引用\[2\]中的解决方法,你也可以在使用`yaml.dump()`方法保存文件时指定编码格式为utf-8。例如:
```python
with open(save_dir / 'hyp.yaml', 'w', encoding='utf-8') as f:
yaml.dump(hyp, f, sort_keys=False)
```
希望这些解决方法能够帮助你解决问题。
#### 引用[.reference_title]
- *1* [ ‘gbk’ codec can’t decode byte 0x80 in position 2467: illegal multibyte sequence](https://blog.csdn.net/wujiaojue/article/details/129906085)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 218: illegal multibyte sequence](https://blog.csdn.net/Vertira/article/details/127453942)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 198: illegal multibyte sequence](https://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/128225609)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文