Skip to content

Instantly share code, notes, and snippets.

@Black-Milk
Last active October 22, 2018 11:51
Show Gist options
  • Save Black-Milk/9361768 to your computer and use it in GitHub Desktop.
Save Black-Milk/9361768 to your computer and use it in GitHub Desktop.
Sublime REPL settings for Anaconda distribution of Python. Included are REPL settings for python and ipython running under python 2.7 and python 3.3. Be sure to provide the appropriate path to your Anaconda Python 2.7 and Python 3.3 executables within the lines that start with "cmd" .
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{
"caption": "Python",
"id": "Python",
"children":[
{
"command": "repl_open",
"caption": "Python 2.7 - Anaconda",
"id": "repl_python",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/anaconda/bin/python2.7", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{
"command": "repl_open",
"caption": "Python 3.3 - Anaconda",
"id": "repl_python",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/anaconda/envs/py3k/bin/python3.3", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{
"command": "repl_open",
"caption": "IPython 2.7 - Anaconda",
"id": "repl_python_ipython",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": ["/anaconda/bin/python2.7", "-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"
}
}
},
{
"command": "repl_open",
"caption": "IPython 3.3 - Anaconda",
"id": "repl_python_ipython",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": ["/anaconda/envs/py3k/bin/python3.3", "-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"
}
}
}
]
}
]
}]
}
]
@Black-Milk
Copy link
Author

Go to your ST3 packages directory and inside create a folder titled User, then inside of this folder, create the directory of folders as follows: SublimeREPL>config>Python. Inside of the Python folder create a text file with the contents of this gist and name it Main.sublime-menu.

@wellermatt
Copy link

Excellent gist, thank you very much

@amarting
Copy link

Hi, I did all as you mentioned. Either way, I am getting the following error when trying to run python3 from sublime repl

PermissionError(13, 'Permission denied')

@Mac13kW
Copy link

Mac13kW commented Sep 19, 2015

Hi amarting,

If you are on Windows then you need to change the path to your Python executable to something like this:
"cmd": ["C:/Anaconda/python.exe", "-i", "-u"],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment