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"

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa7 in position 213: illegal multibyte sequence

 

如何查看该项目使用的依赖包:
pip install pipreqs # 安装pipreqs
CD到项目文件的根目录下执行:pipreqs ./

上一篇:set: Illegal option -解决方案


下一篇:MySql查询报错:Illegal mix of collations