将Sublime Text 2 Packages指向正确的python安装

dou*_*oug 13 python macos environment-variables sublimetext sublimetext2

我只是想将Sublime Text 2 Package(SublimeREPL)指向正确的 python安装 - 此刻,它正在拾取错误的一个.

这里的故事对Mac用户来说很熟悉.Mac OS附带了一个python安装,它用于各种需要python的操作系统.像许多其他人一样,我不喜欢使用这个系统python(它位于/ System/Library/...)因为它通常已经过时了,当然更新它并不是一个好主意 - 它是一个工作的python Mac OS使用的安装,并更新导致依赖于该安装的操作系统任务中断的风险.

但这是SublimeREPL软件包所采用的版本:

Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Run Code Online (Sandbox Code Playgroud)

我用于开发的版本(安装在/ Library/Frameworks /中并且符号链接到/ usr/local/bin)是:

@ > python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Run Code Online (Sandbox Code Playgroud)

Sublime 2 Text正在其他地方获取正确的版本,除非使用SublimeREPL包,因此该Package中的一个配置文件中必须有一个设置,它允许我将SublimeREPL指向正确的python.

但我找不到它.

似乎我已经用尽所有合理的选项,通过我的/ Sublime Text 2/Packages /目录查看必须位于:

SublimeREPL/

    SublimeREPL (OSX).sublime-settings
    SublimeREPL.sublime-settings
Run Code Online (Sandbox Code Playgroud)

要么

User/

    SublimeREPL.sublime-settings
Run Code Online (Sandbox Code Playgroud)

实际上,我在上面添加了以下三个 JSON文件中的每一个,但没有效果:

{
    "default_extend_env": {"PATH": "/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin/python2.7:{PATH}"}
}
Run Code Online (Sandbox Code Playgroud)

Ste*_*oth 18

如果要使用repl_open,可以cmd在配置中编辑参数.我使用的是Ubuntu,它位于:

/home/stav/.config/sublime-text-2/Packages/SublimeREPL/config/Python/Main.sublime-menu

{"command": "repl_open",
"caption": "Python",
"id": "repl_python",
"mnemonic": "p",
"args": {
  "type": "subprocess",
  "encoding": "utf8",
  "cmd": ["/usr/local/bin/python", "-i", "-u"],
  "cwd": "$file_path",
  "syntax": "Packages/Python/Python.tmLanguage",
  "external_id": "python"
  }
},
Run Code Online (Sandbox Code Playgroud)