美文网首页
Sublime3 - Python

Sublime3 - Python

作者: ienos | 来源:发表于2019-03-11 16:42 被阅读0次

Sublime 如何 Build Python

  • New Build System
  • 添加新的命令 Path : Library/Application Support/Sublime Text 3/Packages/User/
  • Add Python :
{
  "cmd":["/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7","-u","$file"],
}

Sublime 运行 Python 语法错误

错误提示 : IndentationError: unindent does not match any outer indentation level
问题原因 : Tab 和 Space 的空格不同
解决方法 : Prefences -> Settings -> Default

"draw_white_space": "all",  # 空格用划线显示
"translate_tabs_to_spaces": true # 用 space 代替 tab

Sublime Python 控制台支持输入

  • 安装插件 SublimeRPEL
  • Rrefences -> Settings -> Key Bindings 添加
[
     { "keys":["f5"], "caption": "SublimeREPL: Python - RUN current file", "command": "run_existing_window_command", "args":{"id": "repl_python_run","file": "config/Python/Main.sublime-menu"}}
]
  • F5+Fn 运行 Python

Sublime 快捷键

ctrl+` 显示控制台
ctrl+shift+p

Sublime 手动安装 Package Control

  • 前往 GitHub 下载
  • 将 package_control 文件夹复制到 Preferences->Browse Packages
  • 重启 Sublime,如果 Preferences 有 PackageSetting 和 Package Control 就说明安装成功
  • CTRL+SHIFT+P 输入 install 选中 Install Package 就可以安装插件
  • Python 代码补全插件:Python AutoComplete

使用 Package Control 无法安装插件

错误提示 : There are no packages available for installation
解决方法 :

  • 前往 GitHub 下载
  • Preferences -> Package Setting -> Package Control -> Setting User 用户下设置
    "channels": [
        "$(channel_v3.json - path)"
    ]

相关文章

网友评论

      本文标题:Sublime3 - Python

      本文链接:https://www.haomeiwen.com/subject/jzmbpqtx.html