python 3 UnicodeDecodeError when pip install package

Issue

安装python库时报错,UnicodeDecodeError

pip install package UnicodeDecodeError

Solution

打开python36\lib\site-packages\pip\compat\__init__.py

修改console_to_str函数,将编码改为gbk

1
return s.decode('utf-8')

改为:

1
return s.decode('gbk')

Reason

我的路径中含有中文,解码失败后,python默认使用utf-8,然而windows中文应该使用gbk

visual studio code convert tab to space motion blur

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×