windows装pip出现的问题 (改字符编码引起的错误)

在windows上装pip,一切就绪,安装没什么偏差之后:)

然后执行命令windows装pip出现的问题 (改字符编码引起的错误)_第1张图片

出了上面那样的问题

pip3就可以使用,然而pip2.7不能用):

一开始是以为版本问题,卸载了python2.7重新安装, pip是在python安装包中附加安装上去的,而且版本也对

然后去搜答案,一开始没搜到,  注意到最一行错误代码信息

Python 2.7 : LookupError: unknown encoding: cp65001 [duplicate]

搜到了

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

你可能感兴趣的:(python)