-1
nano  /usr/local/lib/python2.7/site-packages/sitecustomize.py

import sys  
reload(sys)  
sys.setdefaultencoding('UTF-8')  

after i finished ,

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

What is the matter?

showkey
  • 482
  • 42
  • 140
  • 295

1 Answers1

0

You need to read following:

  1. Why should we NOT use sys.setdefaultencoding("utf-8") in a py script?
  2. How to print UTF-8 encoded text to the console in Python < 3?

I recommend using # -*- coding: utf-8 -*- to top of your .py file.

Community
  • 1
  • 1
jeyraof
  • 863
  • 9
  • 28