a616652325 发表于 2017-4-24 10:50:47

Python 安装编码报错

【基本介绍】
Python的编码问题,永无止境。
【错误介绍】

系统默认的编码是ascii
# python
Python 2.6.8 (unknown, Nov7 2012, 14:47:45)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.getdefaultencoding()
ascii
>>>

在报错的文件中临时添加utf8 或者 gb18030

import sys
reload(sys)
sys.setdefaultencoding('utf8')

【参考】
http://blog.csdn.net/meylovezn/article/details/18080515
http://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte
页: [1]
查看完整版本: Python 安装编码报错