当我在 REPL、EVAL 或 TRANSFER 中选择时,运行 py 时出现以下错误:
Cannot find REPL for 'python'
我使用 python 3,并阅读其他帖子我进行了更改以在 sublime text 3 中使用
1.创建文件名:Python3.sublime.build,代码如下:
{
"path": "/Library/Frameworks/Python.framework/Versions/3.3/bin/",
"cmd": ["python3.3", "-u", "$file"],
"env":{},
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
然后我可以选择构建 Python3 系统
2.在 sublime REPL 的设置中 - 默认我把这个:
"default_extend_env": {"PATH": "/Library/Frameworks/Python.framework/Versions/3.3/bin/python3:{PATH}"},
并更改Main.sublime-menu
位于Packages/SublimeREPL/config/Python
其中的文件:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{"caption": "Python",
"id": "Python",
"children":[
{"command": "repl_open",
"caption": "Python 3",
"id": "repl_python3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "Python 3 - IPython",
"id": "repl_python_ipython3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": {
"osx": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"linux": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"windows": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-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"
}
}
}
]}
]
}]
}
]
我认为必须有一种简单的方法来引用 python 3,但我找不到或不清楚,当我在 Tools、SublimeREPL、Python 和 Python 3 中选择时,它会使用 python 3 打开一个新选项卡