其他分享
首页 > 其他分享> > UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa7 in position 213: illegal multibyte sequence

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_code
    exec(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 main
    init(args)
  File "d:\python37\lib\site-packages\pipreqs\pipreqs.py", line 409, in init
    follow_links=follow_links)
  File "d:\python37\lib\site-packages\pipreqs\pipreqs.py", line 122, in get_all_imports
    contents = 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 ./

标签:py,213,lib,sequence,illegal,pipreqs,python37,File,line
来源: https://blog.csdn.net/zbj18314469395/article/details/113816948