[python]python安装包错误

时间:2023-03-10 02:24:13
[python]python安装包错误
 “UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xb0 in position : ordinal not in range()” 

在windows XP上

解决方法:

Solution:
====================== It is because when Python install some packages, it will check the Windows Registry, some Chinese software like Aliwangwang import ‘gbk’ value to the HKEY_CLASSES_ROOT. So Python doesn’t work. It can be solved like this: open C:\Python27\Lib\ mimetypes.py with Notepad ++ or other editor, then search the line ” default_encoding = sys.getdefaultencoding()”. add codes to the line above like this: if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()
From:

参考链接:

http://*.com/questions/17931726/ascii-codec-cant-decode-error-when-use-pip-to-install-uwsgi/20986067#20986067

http://blog.libofeng.cn/?p=37