标签:bubuko enc python2 src sys odi error error: blog
首先添加如下代码:
import sys
reload(sys)
sys.setdefaultencoding(‘utf-8‘)
如果继续报错:LookupError: unknown encoding: cp0
则在系统变量中加上PYTHONIOENCODING,变量值为utf-8
参考链接:
1.http://wangye.org/blog/archives/629/
2.https://blog.csdn.net/u010239102/article/details/78126822
解决Python2.7的UnicodeEncodeError: ‘ascii’ codec can’t encode异常错误
标签:bubuko enc python2 src sys odi error error: blog
原文地址:https://www.cnblogs.com/rebaomi/p/9636346.html