UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 816: illegal multibyte sequence

Problem :

Python 3.6 虚拟环境里 pip install -r requirements.txt 报错

UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 816: illegal multibyte sequence


(up-env) C:\Users\micha\Desktop\uphmp>pip install -r requirements.txt
Exception:
Traceback (most recent call last):
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\cli\base_comm
and.py", line 179, in main
    status = self.run(options, args)
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\commands\inst
all.py", line 289, in run
    self.name, wheel_cache
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\cli\base_comm
and.py", line 289, in populate_requirement_set
    use_pep517=options.use_pep517):
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\req\req_file.
py", line 103, in parse_requirements
    filename, comes_from=comes_from, session=session
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\download.py",
 line 445, in get_file_content
    content = auto_decode(f.read())
  File "C:\Users\micha\Desktop\uphmp\up-env\lib\site-packages\pip-19.0.3-py3.6.egg\pip\_internal\utils\encodin
g.py", line 38, in auto_decode
    locale.getpreferredencoding(False) or sys.getdefaultencoding(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 816: illegal multibyte sequence

(up-env) C:\Users\micha\Desktop\uphmp>pip install -r requirements.txt

Solution :

requirement.txt 文件开头加# -*- coding:utf-8 -*-

申明编码格式 ,因为里面安装的包有中文注释。

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值