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

9条回应:“SublimeText3 使用anaconda包配置python环境”

  1. Top War hack说道:

    … [Trackback]

    […] Information on that Topic: me.eluup.com/1589.html […]

  2. Izabella说道:

    … [Trackback]

    […] There you can find 39658 additional Information on that Topic: me.eluup.com/1589.html […]

  3. 카지노说道:

    … [Trackback]

    […] Find More Information here on that Topic: me.eluup.com/1589.html […]

  4. … [Trackback]

    […] Read More to that Topic: me.eluup.com/1589.html […]

  5. … [Trackback]

    […] Read More on that Topic: me.eluup.com/1589.html […]

  6. Online Shopping说道:

    … [Trackback]

    […] Info on that Topic: me.eluup.com/1589.html […]

  7. … [Trackback]

    […] Find More Information here to that Topic: me.eluup.com/1589.html […]

  8. child porn说道:

    … [Trackback]

    […] Read More on on that Topic: me.eluup.com/1589.html […]