如何使用Anaconda的解释器设置SublimeREPL? [英] How Do I Setup SublimeREPL with Anaconda's interpreter?
问题描述
我喜欢Sublimetext中的Python,但我真正需要的是一种用于数据探索的交互模式.但是,对于我一生来说,我无法让SublimeREPL使用Anaconda的解释器.任何想法将不胜感激.
I love Python in Sublimetext, but what I really need is an interactive mode for data exploration. However, for the life of me I cannot get SublimeREPL to use Anaconda's interpreter. Any ideas would be appreciated.
我已将以下内容添加到SublimeREPL.settings.user文件中,但没有任何作用:
I have added the following to my SublimeREPL.settings.user file, but it doesn't have any effect:
{
"default_extend_env": {"PATH": "Users/anton/anaconda/envs/py3k/bin/python3:{PATH}"}
}
推荐答案
在您的Packages/User
文件夹中,创建具有以下内容的SublimeREPL/config/Python/Main.sublime-menu
:
In your Packages/User
folder, create SublimeREPL/config/Python/Main.sublime-menu
with the following contents:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{
"caption": "Python",
"id": "Python",
"children":[
{
"command": "repl_open",
"caption": "Python - Anaconda",
"id": "repl_python",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/path/to/Anaconda/python", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{
"command": "repl_open",
"caption": "IPython - Anaconda",
"id": "repl_python_ipython",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": ["/path/to/Anaconda/python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {
"PYTHONIOENCODING": "utf-8",
"SUBLIMEREPL_EDITOR": "$editor"
}
}
}
]
}
]
}]
}
]
在"cmd"
行中,将/path/to/Anaconda/python
更改为要使用的python可执行文件的实际路径.如果您使用的是Windows,请使用单个/
作为路径定界符,或使用两个\\
:
In the "cmd"
lines, change /path/to/Anaconda/python
with the actual path to your python executable you want to use. If you're on Windows, either use a single /
as path delimiter, or double \\
:
c:/Anaconda/bin/python.exe
# or
c:\\Anaconda\\bin\\python.exe
保存文件,您现在应该具有Tools -> SublimeREPL -> Python -> Python - Anaconda
和IPython - Anaconda
菜单选项,才能使用Anaconda解释器启动REPL.如果您安装了多个版本的Python(例如2.7和3.3),则可以复制children
内容并适当地更改caption
和cmd
路径.
Save the file, and you should now have Tools -> SublimeREPL -> Python -> Python - Anaconda
and IPython - Anaconda
menu options to start REPLs with the Anaconda interpreter. If you have multiple versions of Python installed (for example, 2.7 and 3.3) you can just duplicate the children
contents and alter the caption
and cmd
paths appropriately.
这篇关于如何使用Anaconda的解释器设置SublimeREPL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!