SublimeText3 使用anaconda包配置python环境


sublime text3 很好的文本编辑器,用来运行小脚本很适合。介绍一下如何配置python使用环境,sublime里面支持python最好的代码提示、参数不全等功能是anaconda插件。

1) 下载sublime text3

https://www.sublimetext.com/3

2) 安装包插件

打开sublime text3 , 按Shift+ctrl+P, 进入命令界面,输入install package control,安装这个插件。

3) 安装anaconda插件

按shift+ctrl+P,进入package control, 等一会儿在弹出的窗口内搜索anaconda插件,安装。

4)配置anaconda插件

进入preference>package settings>anaconda>settings default

改变python的解释器的路径,以及可以修改错误提示的样式等。

下面这几个参数可以修改一下,不然错误提示比较难看,外面一堆框框。  各个参数代表了什么意思,可以看上面的注释。

/*

        If 'outline' (default), anaconda will outline error lines.
        If 'fill', anaconda will fill the lines.
        If 'solid_underline', anaconda will draw a solid underline below regions.
        If 'stippled_underline', anaconda will draw a stippled underline below regions.
        If 'squiggly_underline', anaconda will draw a squiggly underline below regions.
        If 'none', anaconda will not draw anything on error lines.
    */
    "anaconda_linter_mark_style": "stippled_underline",


    /*
        If this is set to false, anaconda will not underline errors.
    */
    "anaconda_linter_underlines": true,


    /*
        If this is set to true, anaconda will show errors inline.
    */
    "anaconda_linter_phantoms": false,

5)sublime repl 插件

这个可以更加友好的开启ipython等。直接在package control里面下载安装。

在preference>browse packages>sublimeREPL>config>python>Main.sublime-menu, 打开编辑python的interpreter:

"children":[
                    {"command": "repl_open",
                     "caption": "Python",
                     "id": "repl_python",
                     "mnemonic": "P",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": ["D:/ProgramFiles/anaconda3/python", "-i", "-u"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Python/Python.tmLanguage",
                        "external_id": "python",
                        "extend_env": {"PYTHONIOENCODING": "utf-8"}
                        }
                    },

cmd这一行里的python路径替换为自己本地所在的python路径,注意是所有的。

6)sublime REPL快捷键设置

可以参考如下设置,分别设置了python调试,运行文件,python shell, 系统cmd等快捷键。


     {"keys": ["ctrl+f5"],
    "caption": "SublimeREPL: Python - PDB current file",
    "command": "run_existing_window_command","args":
    {
    "id": "repl_python_pdb",
    "file": "config/Python/Main.sublime-menu"
    }
  },{"keys":["f5"],
    "caption": "SublimeREPL: Python - RUN current file",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_python_run",
    "file": "config/Python/Main.sublime-menu"
    }
},{"keys":["f6"],
    "caption": "SublimeREPL: Python",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_python",
    "file": "config/Python/Main.sublime-menu"
    }
},{"keys":["f7"],
    "caption": "SublimeREPL: Shell",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_shell",
    "file": "config/Shell/Main.sublime-menu"
    }
},{"keys":["ctrl+shift+f5"],
    "caption": "SublimeREPL: Python - IPython",
    "command": "run_existing_window_command", "args":
    {
    "id": "repl_python_ipython",
    "file": "config/Python/Main.sublime-menu"
    }
}

]

配置好之后,就可以发现已经有了文档提示,代码补全、参数填充等功能,十分方便。
————————————————
版权声明:本文为CSDN博主「xiaozisheng2008_」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiaozisheng2008_/article/details/80290474

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值