本文主要是介绍UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa7 in position 213: illegal multibyte sequence,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在查看Python项目已来报的时候,输入 pipreqs ./ 之后报如下错误:
Traceback (most recent call last):File "d:\python37\lib\runpy.py", line 193, in _run_module_as_main"__main__", mod_spec)File "d:\python37\lib\runpy.py", line 85, in _run_codeexec(code, run_globals)File "D:\Python37\Scripts\pipreqs.exe\__main__.py", line 7, in <module>File "d:\python37\lib\site-packages\pipreqs\pipreqs.py", line 470, in maininit(args)File "d:\python37\lib\site-packages\pipreqs\pipreqs.py", line 409, in initfollow_links=follow_links)File "d:\python37\lib\site-packages\pipreqs\pipreqs.py", line 122, in get_all_importscontents = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 213: illegal multibyte sequence
解决:
显示编码不对,那指定编码就好了:
pipreqs ./ --encoding="utf-8"
如何查看该项目使用的依赖包:
pip install pipreqs # 安装pipreqs
CD到项目文件的根目录下执行:pipreqs ./
这篇关于UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa7 in position 213: illegal multibyte sequence的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!