码迷,mamicode.com
首页 > 编程语言 > 详细

sublime text3配置python开发环境(windows版)

时间:2018-07-21 14:31:51      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:设置   exist   pack   网址   nbsp   control   python开发   python3   cond   

安装阶段:

  1. sublime text3的安装:

    • 下载网址:https://www.sublimetext.com/
    • 下载完成后 ,点击安装即可。
  2. 安装Package Control:

    • 点击 Tools -> install Package Control
  3. 安装anaconda:

    • ctrl+shift+p -> 输入install package -> 输入anaconda -> 回车
  4. 安装SublimeREPL:

    • ctrl+shift+p -> 输入install package -> 输入 sublimeREPL -> 回车
  5. 安装Djaneiro:

    • ctrl+shift+p -> 输入install package -> 输入 Djaneiro -> 回车

配置阶段:

  • 配置SublimeREPL:

      Preferences -> Browse Packages -> SublimeREPL -> config -> python ->打开 Main.sublime-menu -> 找到
{"command": "repl_open",
                     "caption": "Python - RUN current file",
                     "id": "repl_python_run",
                     "mnemonic": "R",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": ["python", "-u", "-i", "$file_basename"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Python/Python.tmLanguage",
                        "external_id": "python",
                        "extend_env": {"PYTHONIOENCODING": "utf-8"}
                        }
                    },

 修改其中的 "cmd" 项。

    • 如果电脑上装有python2和python

        • 想要使用python2的cmd就填入 "cmd": ["python", "-u", "-i", "$file_basename"]
        • 想要是要python3的cmd就填入 "cmd": ["python3", "-u", "-i", "$file_basename"]
    • 如果电脑中只有一个python版本

        • 直接填入"cmd": ["python", "-u", "-i", "$file_basename"]
  • 自定义SublimeREPL快捷键

    Preferences -> Browse Package -> SublimeREPL -> config -> python -> 打开Default.sublime-commands -> 找到

{
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    },

 

并复制到 Preferences -> Key Bindings 中,并在代码中添加想要设置的快捷键,如下:

{
        "keys": ["shift+f10"],     //修改方括号中的内容,自定义快捷键
        "caption": "SublimeREPL: Python - RUN current file",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    },

 

sublime text3配置python开发环境(windows版)

标签:设置   exist   pack   网址   nbsp   control   python开发   python3   cond   

原文地址:https://www.cnblogs.com/tmdhhl/p/9345923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!