写Python 时遇到这个问题:

 'ascii' codec can't encode characters in position 156-159: ordinal not in range(128)

在找了一堆资料并尝试了:

reload(sys)
sys.setdefaultencoding("utf-8")

之后,无奈还是没有用,最后不得已修改文件Python27\Lib\site.py 并对#479行做了如下修改:

encoding = "utf-8" # Default value set by _PyUnicode_Init()

然后就OK了



blog comments powered by Disqus

Published

15 July 2014

Category

tech_world

Tags