1、編譯運行出現錯誤:SyntaxError: Non-ASCII character '\xe7' in file .. , but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
問題原因:Python在默認狀態下不支持源文件中的編碼所致
解決辦法:按照錯誤建議網址查看http://www.python.org/peps/pep-0263.html
1、文件頭部添加如下注釋碼:
# coding=
例:# coding=utf-8
二、在文件頭部添加如下兩行注釋碼:
#!/usr/bin/python
# -*- coding: -*-
例 :# -*- coding: utf-8 -*-
三、在文件頭部添加如下兩行注釋碼:
#!/usr/bin/python
# vim: set fileencoding= :
例:# vim: set fileencoding=utf-8 :