Sublime2和SublimeREPL [英] Sublime2 and SublimeREPL

查看:183
本文介绍了Sublime2和SublimeREPL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows 7,Python 3.2和Sublime Text 2

Using Windows 7, Python 3.2 and Sublime Text 2

我经历了所有安装SublimeREPL的说明,当我进入Tools -> SublimeREPL -> Python -> Python时收到错误消息:"WindowsError(2,'系统找不到指定的文件.').我进入FAQ,并添加了以下(完全如上所述)的用户首选项:

I went through all of the instruction to install SublimeREPL and when I go to Tools -> SublimeREPL -> Python -> Python I get an error: "WindowsError(2, 'The system cannot find the file speificed.'). I went to the FAQ and added the following (exactly as stated) to the user preferences:

{
 ...
"default_extend_env": {"PATH": "C:/Python32"}
 ...
}`

当我尝试保存文件时,出现另一个错误:尝试解析设置时出错:期望值在...中",它指向SublimeREPL文件.

When I try to save the file I get another error: "Error trying to parse setting: Expected value in..." and it points to the SublimeREPL file.

整个文件是安装随附的通用版本:

The entire file is the generic version that comes with the install:

{
// default_extend_env are used to augment any environment variables
// that should be visible for all subprocess repls launched within
// SublimeREPL. This is a very good place to add PATH extension
// once "PATH": "{PATH}:/home/username/mylocalinstalls/bin" or whatever
"default_extend_env": {},

// Specify whether to move repls to a different Sublime Text group (frame)
// immediately on opening. Setting this to true will simply move it to
// the 'next' group from the one that was in focus when it was opened
// (one down with row layout, one to the right with column and grid
// layout). Alternatively, you can set this to the index of the group in
// which you want all repls to be opened (index 0 being the top-left group).
// Activating this option will NOT automatically change your layout/create
// a new group if it isn't open.
"open_repl_in_group": true,

// Persistent history is stored per REPL external_id, it means that all python
// REPLS will share history. If you wish you can disable history altogether
"persistent_history_enabled": true,

// By default SublimeREPL leaves REPL view open once the underlying subprocess
// dies or closes connection. This is useful when the process dies for an unexpected
// reason as it allows you to inspect it output. If you want. Setting this
// to true will cause SublimreREPL to close view once the process died.
"view_auto_close": false,

// Some terminals output ascii color codes which are not currently supported
// enable this option to filter them out.
"filter_ascii_color_codes": true,

// Where to look for python virtualenvs
"python_virtualenv_paths": [
    "~/.virtualenvs",  // virtualenvwrapper
    "~/.venv"  // venv.bash https://github.com/wuub/venv
],

// Use arrows for history navigation instead of Alt+[P|N]/Ctrl+[P|N]
"history_arrows": true,

// standard sublime view settings that will be overwritten on each repl view
// this has to be customized as a whole dictionary
"repl_view_settings": {
    "translate_tabs_to_spaces": false,
    "auto_indent": false,
    "smart_indent": false,
    "spell_check": false,
    "indent_subsequent_lines": false,
    "detect_indentation": false,
    "auto_complete": true,
    "line_numbers": false,
    "gutter": false
},

// this settings exposes additional variables in repl config files, especially
// those related to sublime projects that are not available through standard API
// WARNING: this will switch your build system back to Automatic each time a REPL
// is started so beware!
"use_build_system_hack": false,

// IP address used to setup autocomplete server in sublimerepl.
// changing this is usefull when you want to exclude one address
// from proxychains/tsocks routing
"autocomplete_server_ip": "127.0.0.1",

// Mapping is used, when external_id of REPL does not match
// source.[xxx] scope of syntax definition used to highlight
// files from which text is being transfered. For example octave
// repls use source.matlab syntax files and w/o this mapping text transfer
// will not work
"external_id_mapping": {
    "octave": "matlab"
},

// If set to true, SublimeREPL will try to append evaluated code to repl
// output before evaluation (e.g. Ctrl+, f)
"show_transferred_text": false

}

我正在尝试使用Python评估Sublime2中的选定代码.

I am trying to evaluate selected code in Sublime2 with Python.

以上是我添加到用户文件(SublimeREPL.sublime-settings-用户)中的内容.除了我添加的内容外,文件中没有其他内容.

The above is what I added to the user file (SublimeREPL.sublime-settings - User). There is nothing else in the file besides what I added.

推荐答案

Sublime REPL默认情况下从Windows系统路径中拾取python.您可以按照

Sublime REPL picks up python from windows system path by default. You can set this path by following this

如果要在 SublimeREPL.sublime设置中进行更改,则需要将行更改为

In case you want to make changes in SublimeREPL.sublime-settings you need to change your line to

"default_extend_env": {"PATH":"{PATH};c:\\Python32"},

  1. 由于您在Windows中,因此需要保存"\"字符以免使用"\\"转义
  2. * SublimeREPL.sublime-settings 是一个JSON文件,因此结尾应为,"
  3. "{PATH};" 部分是可选的.它允许您将python路径添加到现有路径中,而不是覆盖它.
  1. Since you're in windows you'll need to save '\' character from escaping using '\\'
  2. The *SublimeREPL.sublime-settings is a JSON file so it expects ',' at the end
  3. The "{PATH};" part is optional. It allows you to add python path to your existing path instead of overriding it.

这篇关于Sublime2和SublimeREPL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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