Sublime如何配置Python3运行环境
更新时间:2023年11月29日 09:32:16 作者:tian_shl
这篇文章主要介绍了Sublime如何配置Python3运行环境问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
新增Python3编译环境
Tools > Build System > New Build System
将默认内容替换为:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}保存为 Python3.sublime-build
选中Python3环境
Tools > Build System > Python3
使用Python3编译运行
Ctrl + b
可能遇到的问题
问题
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
原因
默认是ascii编码但是输出中包含中文
解决
Preferences > Browse Packages > Users > Python3.sublime-build
修改配置文件, 配置文件中新增一条
"env": {"LANG": "en_US.UTF-8"}修改后如下:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"LANG": "en_US.UTF-8"}
}总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
python处理emoji表情(两个函数解决两者之间的联系)
这篇文章主要介绍了python处理emoji表情,主要通过两个函数解决两者之间的联系,本文通过实例代码给大家介绍的非常完美,对python emoji表情的相关知识感兴趣的朋友一起看看吧2021-05-05


最新评论