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

2024-06-01 08:50:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python portable和内存条的sublime portable,并决定安装sublime REPL,但是当尝试使用python portable作为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中

注意在normal 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"}

有什么想法吗?

谢谢, 安德鲁


Tags: cmdappmainexeusersdocumentsfilesublime
2条回答

多亏了豪尔。。。我安装了package控件,然后是sublimitepl包,然后在keybinding(在preferences下)中,我在用户文件中编写了这个:

[

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

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

是修改后的部分的外观。(与运行当前文件相反,您可能正在修改以交互模式打开解释器的命令)。

相关问题 更多 >