Python easy_install安装插件错误(UnicodeDecodeError)解决办法

来源:互联网 发布:json查看 编辑:程序博客网 时间:2024/03/29 19:54


电脑上安装的Python是2.7.10,在使用easy_install安装pandas库时发生错误:unicodedecodeerror: 'ascii' codec can't decode byte 0xb8 in position 7: ordinal not in range(128)

经过许久的折腾以及资料查找,找到了一个解决办法

  在安装目录下找到 .\Lib\mimetypes.py 该文件,然后在import下添加以下几行代码


1 # add myself
2 if sys.getdefaultencoding() != 'gbk':
3   reload(sys)
4     sys.setdefaultencoding('gbk')
0 0