sublime中按ctrl+B调用python3运行


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

windowns系统下要写完整的python3.exe路径。

以下是macOS的操作,与windows差不多。

sublime text写了python3的代码,ctrl + B运行时却调用了python2,导致运行报错。

这是因为很多系统默认安装了python2,默认调用python的版本就是python2。

解决办法:

我们先来新建一个sublime build system

e578a4c53d2819a4b3c737224eb7f41.png

然后自动打开了一个文本,清空并写入以下内容:

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 text3怎么输入激活码(附激活码)

怎么使用sublime text 中的宏

sublime如何改成中文简体

sublime text2的主要功能是什么

sublime text3如何解决gosublime无法自动补全代码

sublime正确显示中文的方法

sublime text3如何修改tab键为缩进为四个空格

教你快速使用sublime text3编写html

sublime text怎么用

sublime怎么运行html代码?sublime运行的快捷键是什么

更多相关阅读请进入《sublime》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...