本文摘自PHP中文网,作者藏色散人,侵删。

windowns系统下要写完整的python3.exe路径。
以下是macOS的操作,与windows差不多。
用sublime text写了python3的代码,ctrl + B运行时却调用了python2,导致运行报错。
这是因为很多系统默认安装了python2,默认调用python的版本就是python2。
解决办法:
我们先来新建一个sublime build system

然后自动打开了一个文本,清空并写入以下内容:
1 2 3 4 5 6 | {
"env" : { "PYTHONIOENCODING" : "utf8" },
"cmd" : [ "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3" , "-u" , "$file" ],
"file_regex" : "^[ ]*File \"(...*?)\", line ([0-9]*)" ,
"selector" : "source.python"
}
|
“env”: {“PYTHONIOENCODING”: “utf8”}, 是避免中文报错!
阅读剩余部分
相关阅读 >>
详解sublime搭建c/c++编译环境
怎么在windows下安装sublime text3
sublime text怎么用
sublime text3+markdown配置步骤【图文详解】
如何用sublime text创建第一个文档
sublime text3如何配置自动联想python
sublime text 3怎么在ubuntu下支持中文输入
sublime怎么释放被无辜占用的磁盘空间
sublime text3格式化json及格式化sql代码
sublime优点小结
更多相关阅读请进入《sublime》频道 >>
转载请注明出处:木庄网络博客 » sublime中按ctrl+B调用python3运行