2

当我在 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 打开一个新选项卡

4

2 回答 2

0

在视图菜单下将布局设置为“2 行”。从工具下的命令面板中选择“SublimeREPL:Python”。

〜摩根(这方面很新)

于 2014-05-29T03:01:30.667 回答
-1

https://superuser.com/questions/755320/sublime-text-cant-find-interpreters-for-sublimerepl ” 是我这边的交易/修复。** REPL 需要先打开。. . . **
不知道其他人是否也一样,但这个小细节对我来说是关键。哈哈。希望有帮助

于 2015-01-22T13:31:24.953 回答