[python]python安装包错误

 “UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xb0 in position 1: ordinal not in range(128)” 

在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://stackoverflow.com/questions/17931726/ascii-codec-cant-decode-error-when-use-pip-to-install-uwsgi/20986067#20986067

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

posted @ 2014-12-03 14:35  silence.li  阅读(252)  评论(0编辑  收藏  举报