The error means that Unicode characters that your script are trying to print can't be represented using the current console character encoding.
Also try to run set PYTHONIOENCODING=UTF-8
after execute pip --versionwithout reloading terminal if everything going well addPYTHONIOENCODING
as env variable with valueUTF-8
. SeeHow to set the path and environment variables in Windows article to get info how to add Windows variable.
Also you can try to install win-unicode-console with pip:
pip install win-unicode-console
Then reload your terminal and try to execute pip --version
However you can follow suggestions from Windows cmd encoding change causes Python crash answer because you have same problem.
是因为字符编码问题,
我之前在cmd跑py2.7因为utf8的原因中文乱码,然后改了cmd控制台的字符
还写了一篇设置方法的博客):在输入命令chcp 946, cmd 标题栏->属性字体那里改回来就行了 ,(当时为支持utf-8改成了Lucida Console ,现在改成Consolas就可以用了)
然后提出了解决办法让pip支持utf-8的
1 set PYTHONIOENCODING=UTF-8
命令 (我没有尝试,但估计控制台如果调会默认字符会还出毛病吧)
2 或者是 安装一个win-unicode-consloe