UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 2411: illegal multiby
Posted gambler
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 2411: illegal multiby相关的知识,希望对你有一定的参考价值。
|、第一步放bug
Traceback (most recent call last): File "c:programdataanaconda3envssqllib unpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:programdataanaconda3envssqllib unpy.py", line 85, in _run_code exec(code, run_globals) File "C:ProgramDataAnaconda3envssqlScriptspipreqs.exe\\__main__.py", line 9, in <module> File "c:programdataanaconda3envssqllibsite-packagespipreqspipreqs.py", line 470, in main init(args) File "c:programdataanaconda3envssqllibsite-packagespipreqspipreqs.py", line 409, in init follow_links=follow_links) File "c:programdataanaconda3envssqllibsite-packagespipreqspipreqs.py", line 122, in get_all_imports contents = f.read() UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xab in position 2411: illegal multibyte sequence
II、解决方案
根据bug提示就知道是编码出现问题,所以只需要改变编码
1、找到pipreqs包的位置
在bug中有提示,已经具体显示到第几行
2、修改编码
根据上面提示的行数直接找到源头,修改,完成
保存,ok
重新导出
以上是关于UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 2411: illegal multiby的主要内容,如果未能解决你的问题,请参考以下文章
python编码问题:UnicodeDecodeError: 'gbk' codec can't decode
python UnicodeDecodeError: 'ascii' codec can't decode byte ...
UnicodeDecodeError: 'ascii' codec can't decode byte错误解决方案
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd