网站首页 Python Python - Sublime Text 3 控制台不能输出中文的解决方法
Windows系统
Tools -> Build System -> New Build System
{
"cmd": ["python","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "cp936"
}
用上面的代码替换掉"shell_cmd": "make", 保存当前配置文件为: "python3.sublime-build", 然后在Tools -> Build System->选择 "python3"
Mac系统
1. Tools -> Build System -> New Build System
2. 取名 Python3.sublime-build
3. 编辑 Python3.sublime-build,输入:
{
"cmd": ["/Library/Frameworks/Python.framework/Versions/3.6/bin/python3","-u","$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf8"},
}
4. 保存重启sublime,选择Tools -> Build System ->Python3
转载请注明出处!