简体   繁体   English

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

[英]Setting python path for sublimerepl from sublime text?

I use python portable along with sublime portable of a memory stick and decided to install sublime REPL however when trying to use python portable as the build path for sublimerepl it does not specify it. 我使用python可移植以及记忆棒的sublime portable并决定安装sublime REPL但是当尝试使用python portable作为sublimerepl的构建路径时它没有指定它。

To put it simply I can't specify the sublimerepl python path like I can with straight sublime text! 简单地说,我不能像直接的崇高文本一样指定sublimerepl python路径!

I have tried adding the following into SublimeREPL.sublime-settings 我尝试将以下内容添加到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"},

I have also tried changing: 我也尝试过改变:

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

to

"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"],

within Python/Main.sublime-menu 在Python / Main.sublime菜单中

Note in normal sublime I add the following to Python.sublime-build: 请注意,在普通的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"}

Any ideas? 有任何想法吗?

Thanks, Andrew 谢谢,安德鲁

Is it possible you're changing the wrong line of code in /Packages/SublimeREPL/config/Python/Main.sublime-menu ? 您是否有可能在/Packages/SublimeREPL/config/Python/Main.sublime-menu更改了错误的代码/Packages/SublimeREPL/config/Python/Main.sublime-menu If you wish to run REPL on the current file, 如果您希望在当前文件上运行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"}
    }

is what the modified section should look like. 是修改后的部分应该是什么样子。 (It appears you might be modifying the command which opens the interpreter in interactive mode as opposed to running the current file). (看起来您可能正在修改以交互模式打开解释器的命令,而不是运行当前文件)。

Thanks to Hower... I installed the package control, then the sublimePREPL package and, then in the keybinding (under preferences) I wrote this int the user file: 感谢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"}
        }}
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM