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"}
}总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
Tensorflow的可视化工具Tensorboard的初步使用详解
这篇文章主要介绍了Tensorflow的可视化工具Tensorboard的初步使用详解,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-02-02
python读取json文件并将数据插入到mongodb的方法
这篇文章主要介绍了python读取json文件并将数据插入到mongodb的方法,实例分析了Python操作json及mongodb数据库的技巧,需要的朋友可以参考下2015-03-03


最新评论