从sublime文本设置sublimerepl的python路径?

时间:2013-07-08 21:14:07

标签: python sublimetext pythonpath sublimerepl

我使用python portable和sublime portable of memory stick并决定安装sublime REPL但是当尝试使用python portable作为sublimerepl的构建路径时,它没有指定它。

简单地说,我不能像直接的崇高文本一样指定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"}

有什么想法吗?

谢谢, 安德鲁

2 个答案:

答案 0 :(得分:2)

您是否有可能在/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"}
    }

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

答案 1 :(得分:0)

感谢Hower ...我先安装了程序包控件,然后安装了sublimePREPL程序包,然后在键绑定中(在首选项下)我将此int用户文件编写为:

[

{"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"}
        }}
]