SublimeREPL Unable to Find R

こ雲淡風輕ζ 提交于 2019-12-09 04:44:27

问题


Okay, this is driving my crazy. I had set this up before, deleted Sublime Text, and now I can't remember what the right configuration was.

Very simple: I'm running R through SublimeREPL and need to point the REPL to where R is installed.

I followed the directions at http://sublimerepl.readthedocs.org/en/latest/, which say to go into the user-defined REPL settings and add this:

{
 ...
 "default_extend_env": {"PATH": "{PATH}:/home/myusername/bin"}
 ...
} 

where the path points to the right directory. I tried replacing it with

{
 ...
 "default_extend_env": {"PATH": "C:/Program Files/R/R-3.0.2/bin"}
 ...
}

and it's still unable to find R, plus now it's giving me the error:

Error trying to parse settings: Expected value in Packages\User\SublimeREPL.sublime-     settings:2:2

I know this is an easy fix. Can anybody point out what I'm doing wrong here?


*I'm using Sublime Text 3. I previously had this working, but on Sublime Text 2.

  • I've been to http://tomschenkjr.net/using-sublime-text-2-for-r/ and the piece where he mentions "pointing SublimeREPL at R" ... he doesn't include the actual code, as far as I can see

  • I've also seen this thread Error 2 The system cannot find the file specified in Sublime Text 2, Windows 8, but I had it working before and didn't have to do anything along those lines


回答1:


Go to Preferences -> Browse Packages... and create a directory tree User/SublimeREPL/config/R. In that directory, create a new file named Main.sublime-menu with the following contents:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open",
                 "caption": "Rterm",
                 "id": "repl_r",
                 "mnemonic": "r",
                 "args": {
                    "type": "subprocess",
                    "external_id": "r",
                    "additional_scopes": ["tex.latex.knitr"],
                    "encoding": {"windows": "$win_cmd_encoding"},
                    "soft_quit": "\nquit(save=\"no\")\n",
                    "cmd": {"windows": ["C:/Program Files/R/R-3.0.2/bin/x64/Rterm.exe", "--ess", "--encoding=$win_cmd_encoding"]},
                    "cwd": "$file_path",
                    "extend_env": {"windows": {"PATH": "{PATH}:/C/Program Files/R/R-3.0.2/bin"}},
                    "cmd_postfix": "\n",
                    "suppress_echo": {"windows": false},
                    "syntax": "Packages/R/R.tmLanguage"
                    }
                }
            ]
        }]
    }
]

Save the file, and you should now have a Tools -> SublimeREPL -> Rterm menu option. Double-check that the path is the correct one to the Rterm.exe file. On my computer (32-bit XP) it's in the i386 subfolder of bin, so yours may be in bin/x64 or something like that.

I hope this helps, let me know if you still have issues.




回答2:


I resolved this by adding the location of Rterm.exe to PATH



来源:https://stackoverflow.com/questions/21115295/sublimerepl-unable-to-find-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!