sublime text 3 环境设置
1. 设置build system 环境
tool -> build system -> new build system ,粘贴以下代码并保存
{
"cmd":["python.exe", "-u", "$file"],
"path":"C:/Users/Sablier/AppData/Local/Programs/Python/Python37",
// 注意:路径根据自己的python安装路径而定
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "cp936" ,
// 识别中文环境
}
//ctrl + B 执行程序
//ctrl + shift + c 终止程序
//ctrl + shift + P 加载控制台
2.为cancel build 建立快捷键
tool - > cancel build
可中止程序运行
快捷键中是ctrl+break
然而现在的大多数键盘已经不好按break键了,于是要修改键位
preferences - > key bindings
在左边搜索cance_build,模仿左边的语法在右边加上自己的自定义
{ "keys": ["ctrl+shift+c"], "command": "cancel_build" },
3. 安装sublime REPL 交互插件
1. Ctrl+shift+p,在弹出的对话框中输入 packages control 安装 packages control 环境, 并重启sublime
2. Ctrl+shift+p,在弹出的对话框中输入install packages 等待 packages control 初始化完成,键入sublime REPL 搜索并安装。重启sublime。
3. 配置 python3 运行环境(如果电脑上只有一个版本的python,则可以不用执行。如果同时有 python2 和 3 则需要配置单独的 python3 启动环境)
Packages -> Browse Package 找到 SublimeREPL的文件夹 -> config (语言版本文件夹),新建 python3 文件夹;
进入python3文件夹,新建 Default.sublime-commands 和 Menu.sublime-menu 两个文件(模仿Python文件夹);
在 Default.sublime-commands 中黏贴以下数据并保存:
// 我们Python3目前只需要能打开shell运行,和运行这个脚本,两个功能,因此就只要包含Python3.5 和 Python3.5 – Run current file两项就好了(本行不要复制) [
{
"caption": "SublimeREPL: Python3",
"command": "run_existing_window_command", "args":
{
"id": "repl_python3",
"file": "config/Python3/Main.sublime-menu"
}
}, {
"caption": "SublimeREPL: Python3 - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python3_run",
"file": "config/Python3/Main.sublime-menu"
}
}
]
在 Menu.sublime-menu 中粘贴以下数据并保存:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[{
"caption": "Python3",
"id": "Python3",
"children":
[{
"command": "repl_open",
"caption": "Python3",
"id": "repl_python3",
"mnemonic": "P",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python3", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python3",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
}, {
"command": "repl_open",
"caption": "Python3 - RUN current file",
"id": "repl_python3_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python3", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python3",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
}
]}
]
}]
}
]
4. preferences - > key bindings 粘贴以下代码,注意只能有一个[],设定F5为sublimeREPL -> python3 -> RUN current file 快捷键。
{
"keys":["f5"],
"caption": "SublimeREPL: Python3 - RUN current file",
"command": "run_existing_window_command",
"args":{
"id": "repl_python3_run",
"file": "config/Python3/Main.sublime-menu"
}
}
最新文章
- [LeetCode] Sort Transformed Array 变换数组排序
- springmvc 格式化使用Jackjson格式化报Failed to write HTTP message
- Codeforces Round #323 (Div. 2) C. GCD Table 暴力
- Tips of Python!
- HTML5 Canvas核心技术—图形、动画与游戏开发.pdf2
- Python 中文报错 SyntaxError: Non-ASCII character解决办法
- 记一次 java程序优化
- [ACM] HDU 2295 Radar (二分法+DLX 重复覆盖)
- Python进阶---面向对象第二弹
- CentOS 6.2 中文
- Flutter Inspector 功能:Toggle Platform,Show Debug Paint,Show Paint Baselines
- scratch如何获取透明的图片
- Python 模块 re (Regular Expression)
- 利用HBuilder打包前端开发webapp为apk
- 安卓读写INI文件
- 椭圆曲线密码体制(ECC)简介
- RabbitMQ - exchange
- Hadoop运行Jar文件时Output错误
- 有的系统区apk需要对其系统签名,才能正常使用。
- mq组件介绍