将Sublime Text 2软件包引导到正确的python安装 [英] Directing Sublime Text 2 Packages to the correct python installation

查看:164
本文介绍了将Sublime Text 2软件包引导到正确的python安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想将Sublime Text 2 Package( SublimeREPL )引导到正确的 python安装 - 目前来说,它是错误的。 p>

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



但是这是由SublimeREPL包提供的版本: p>

  Python 2.7.1(r271:86832,2011年6月25日,05:09:01)
[GCC 4.2.1 (基于Apple Inc. build 5658)(LLVM build 2335.15.00)]在darwin
上输入help,copyright,credits或license了解更多信息。
>>>

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

  @> python 
Python 2.7.3(v2.7.3:70274d53c1dd,2012年4月9日,20:52:43)
[GCC 4.2.1(Apple Inc. build 5666)(dot 3)] on darwin
有关更多信息,请输入帮助,版权,信用或许可证。
>>>

Sublime 2文本正在其他地方拾取正确的版本, SublimeREPL包,所以在该包中的一个配置文件中必须有一个设置,这将允许我将SublimeREPL引导到正确的python。



但是我找不到



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

  SublimeREPL / 

SublimeREPL(OSX).sublime-settings
SublimeREPL.sublime-settings

 用户/ 

SublimeREPL.sublime-settings

事实上,我在上面添加了以下每个三个 JSON文件,不起作用:

  {
default_extend_env:{PATH:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin/python2.7:{P ATH}}
}


解决方案

要使用 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
}
} ,


I just want to direct a Sublime Text 2 Package (SublimeREPL) to the correct python installation--at the moment, it's picking up the wrong one.

The story here is familiar to Mac users. The Mac OS comes includes a python install which it uses for various OS stuff for which python is required. Like many others, i prefer not to use this system python (which resides in /System/Library/...) becasue it is usually out of date and of course it's not a good idea to update it--it is a working python install used by the Mac OS, and updating risks causing those OS tasks that depend on that install to break.

But that's the version picked up by the package 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.
>>> 

The version i use for development (and which is installed in /Library/Frameworks/ and symlinked to /usr/local/bin) is:

@ > 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.
>>> 

Sublime 2 Text is picking up the correct version elsewhere, except when using the SublimeREPL Package so there must be a setting in one of the config files in that Package that will let me direct SublimeREPL to the correct python.

But i can't find it.

It seems that i have exhausted all plausible options, which, looking through my /Sublime Text 2/Packages/ directory must reside in either:

SublimeREPL/

    SublimeREPL (OSX).sublime-settings
    SublimeREPL.sublime-settings

Or

User/

    SublimeREPL.sublime-settings

In fact, i added the following each of the three JSON files above, with no effect:

{
    "default_extend_env": {"PATH": "/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin/python2.7:{PATH}"}
}

解决方案

If you want to use repl_open you could edit the cmd parameter in the config. I am using Ubuntu and it is located in:

/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"
  }
},

这篇关于将Sublime Text 2软件包引导到正确的python安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆