已配置了sublime text3 使用anaconda Python3 的build system
{
"cmd": ["python", "-u", "$file"],
"path":"/Users/areana/software/anaconda3/bin",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "[source.python]",
}
在網上查找了一些資料,用import sys
print(sys.stdout.encoding)
打印了當前的編碼,輸出結果 'US-ASCII'
確實是輸出設置的問題,默認英文狀態採用 ASCII
肯定無法顯示中文。
根據網上的修改方法,在配置中加入
"env": {"LANG": "en_US.UTF-8"}
{
"cmd": ["python", "-u", "$file"],
"path":"/Users/areana/software/anaconda3/bin",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "[source.python]",
"env": {"LANG": "en_US.UTF-8"}
}
修改後配置如上,重啓sublime後中文輸出正常了。
參考鏈接:https://blog.csdn.net/u011286584/article/details/55259897