ubuntu python2.7解决 UnicodeEncodeError: 'ascii' 支持utf8
2016-02-14 13:38
746 查看
打开 /usr/lib/python2.7/sitecustomize.py
文件头加入:
# install the apport exception handler if available
import sys
reload(sys)
sys.setdefaultencoding('utf8')
try:
import apport_python_hook
except ImportError:
pass
else:
apport_python_hook.install()
上面红色为新加入的代码
文件头加入:
# install the apport exception handler if available
import sys
reload(sys)
sys.setdefaultencoding('utf8')
try:
import apport_python_hook
except ImportError:
pass
else:
apport_python_hook.install()
上面红色为新加入的代码
相关文章推荐
- 如何编写bat脚本定时执行某python脚本
- python logging
- Python 路谱
- python绘制非常漂亮的图表
- python编程常用模板总结
- opencv+python学习笔记【1】开发环境配置
- Python 3.x - 一个简单的客户端Get请求程序
- python学习笔记-Day14 -css基础知识-part2
- python之xml文件处理的例子-问题描述及解决方法
- Windows下安装Python PIP
- python编码最佳实践之总结
- python 简单绘图
- python实现百度贴吧爬虫
- Python 中的浮点数
- python交互式文档计算格式
- python动态网页爬取——四六级成绩批量爬取
- Python在Console下显示文本进度条的方法
- Draw Picture With Python Matplotlib
- 【python笔记】python中的list、tuple、set、dict用法简析
- Python安装——Windows