【问题标题】:Setting python path for sublimerepl from sublime text?从 sublime 文本设置 sublimerepl 的 python 路径?
【发布时间】:2013-07-08 21:14:07
【问题描述】:

我使用 python 便携式和记忆棒的 sublime 便携式,并决定安装 sublime REPL,但是当尝试使用 python 便携式作为 sublimerepl 的构建路径时,它没有指定它。

简单地说,我无法像使用直接 sublime 文本那样指定 sublimerepl python 路径!

我尝试将以下内容添加到 SublimeREPL.sublime-settings

"default_extend_env": {"PATH": "{PATH}:C:\\Users\\Andy\\Documents\\_Main\\M-Stick Backups\\08.07.13\\Computing\\Python Portable\\Portable Python 2.7.3.1\\App\\python.exe"},

我也尝试过改变:

"cmd": ["python", "-i", "-u"],

"cmd": ["C:\\Users\\Andy\\Documents\\_Main\\M-Stick Backups\\08.07.13\\Computing\\Python Portable\\Portable Python 2.7.3.1\\App\\python.exe", "-u", "$file"],

在 Python/Main.sublime-menu 中

注意在正常的 sublime 中,我将以下内容添加到 Python.sublime-build:

{"cmd": ["C:\\Users\\Andy\\Documents\\_Main\\M-Stick Backups\\08.07.13\\Computing\\Python Portable\\Portable Python 2.7.3.1\\App\\python.exe", "-u", "$file"],"file_regex": "^[ ]*Iile \"(...*?)\", line ([0-9]*)","selector": "source.python"}

有什么想法吗?

谢谢, 安德鲁

【问题讨论】:

    标签: python sublimetext pythonpath sublimerepl


    【解决方案1】:

    您是否可能在/Packages/SublimeREPL/config/Python/Main.sublime-menu 中更改了错误的代码行?如果你想在当前文件上运行 REPL,

    {"command": "repl_open",
     "caption": "Python - RUN current file",
     "id": "repl_python_run",
     "mnemonic": "d",
     "args": {
        "type": "subprocess",
        "encoding": "utf8",
        "cmd": ["C:\\Users\\Andy\\Documents\\_Main\\M-Stick Backups\\08.07.13\\Computing\\Python Portable\\Portable Python 2.7.3.1\\App\\python.exe", "-u", "$file_basename"],
        "cwd": "$file_path",
        "syntax": "Packages/Python/Python.tmLanguage",
        "external_id": "python",
        "extend_env": {"PYTHONIOENCODING": "utf-8"}
        }
    

    是修改后的部分应该是什么样子。 (看来您可能正在修改以交互模式打开解释器的命令,而不是运行当前文件)。

    【讨论】:

    • 感谢您的回复,但我正在使用 Eval in repl >> block 命令,您知道我可以在哪里编辑该命令吗?
    【解决方案2】:

    感谢 Hower... 我安装了包控制,然后是 sublimePREPL 包,然后在键绑定中(在首选项下)我在用户文件中写了这个:

    [

    {"keys": ["ctrl+b"], "command": "repl_open",
     "caption": "Python - RUN current file",
     "id": "repl_python_run",
     "mnemonic": "d",
     "args": {
        "type": "subprocess",
        "encoding": "utf8",
        "cmd": ["C:\\Users\\giova\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe", "-u", "$file_basename"],
        "cwd": "$file_path",
        "syntax": "Packages/Python/Python.tmLanguage",
        "external_id": "python",
        "extend_env": {"PYTHONIOENCODING": "utf-8"}
            }}
    ]
    

    【讨论】:

      猜你喜欢
      • 2016-04-25
      • 2013-05-04
      • 2014-12-19
      • 1970-01-01
      • 2014-06-02
      • 2012-08-29
      • 1970-01-01
      • 2019-08-28
      • 1970-01-01
      相关资源
      最近更新 更多