sublime text 2編譯Python時打印中文報錯的解決方案
來源:程序員人生 發布時間:2015-03-31 08:03:51 閱讀次數:2508次
當用sublime text 2 編譯 python 文件時,若 print 打印出的中文時,控制臺會報錯:
[Decode error - output not utf⑻]
解決方案以下:
打開 sublime text 2 首選項 -> 閱讀插件,進入 Python 文件夾,并找到 Python.sublime-build 文件。
打開以下:
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0⑼]*)",
"selector": "source.python"
}
將其修改成:
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0⑼]*)",
"selector": "source.python",
"encoding": "cp936"
}
便可解決該問題。
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈