nano /usr/local/lib/python2.7/site-packages/sitecustomize.py
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
我完成后,
root@debian:/home/debian# python
Python 2.7.3 (default, Jan 2 2013, 16:53:07)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.getdefaultencoding()
ascii
怎么回事?
答案 0 :(得分:0)
您需要阅读以下内容:
我建议您使用# -*- coding: utf-8 -*-
作为.py
文件的顶部。