如何设置与RStudio一起使用的安装R版本? [英] How to set up conda-installed R for use with RStudio?

查看:5070
本文介绍了如何设置与RStudio一起使用的安装R版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试设置我的 R 使用 conda (最终与Beaker笔记本一起使用),我想要能够使用 RStudio 与我的安装版本的 R

I've been trying to set up my R using conda (eventually to use with Beaker Notebook) and I want to be able to use RStudio with my conda-installed version of R.

我的安装方法 R

conda install -c r r
conda install -c r r-essentials
conda install -c r r-rserve
conda install -c r r-devtools
conda install -c r r-rcurl
conda install -c r r-RJSONIO
conda install -c r r-jpeg
conda install -c r r-png
conda install -c r r-roxygen2
conda install --channel https://conda.anaconda.org/bioconda bioconductor-edger

我运行那个版本的R(我只安装了这个版本)

I ran that version of R (I only installed this version)

> version
               _                           
platform       x86_64-apple-darwin11.0.0   
arch           x86_64                      
os             darwin11.0.0                
system         x86_64, darwin11.0.0        
status                                     
major          3                           
minor          3.1                         
year           2016                        
month          06                          
day            21                          
svn rev        70800                       
language       R                           
version.string R version 3.3.1 (2016-06-21)
nickname       Bug in Your Hair   

运行 R Jupyter 是一种越野车。例如,当它输出错误时,它输出到 stdout ,并用linebreak分割字符串中的每个字符。我想使用 RStudio ,但我不想安装另一个版本的 R

Running R in Jupyter is kind of buggy. For example, when it outputs errors, it outputs to stdout and splits every character in the string with a linebreak. I want to use RStudio but I don't want to install another version of R.

如何将我的conda版本的 R 路由到RStudio?

How can I route my conda version of R into RStudio?

这是我的 .bash_profile 不知道这将是有用的:

Here's my .bash_profile not sure if this will be useful:

$ cat ~/.bash_profile
# added by Anaconda3 4.0.0 installer
export PATH="/Users/jespinoz/anaconda/bin:$PATH"

export RSTUDIO_WHICH_R=/Users/jespinoz/anaconda/bin/R 

我一直试图遵循这些教程,但我迷失了。我真的不太熟悉环境变量和这样的事情。

I've been trying to follow these tutorials but I am lost. I'm really not too familiar with environment variables and such things.

(1) https://support.rstudio.com/hc/en-us/community/posts/207830688-Using-RStudio-with-conda

(2)启动带有环境变量集的mac eclipse

当我查找我的 R 它指示我:

when I looked for my R it directed me to:

$ which R
/Users/jespinoz/anaconda/bin/R

但来自(1)的指示正在使用这个非常令人困惑的路径:

but the directions from (1) is using this path which is very confusing:

/Users/jespinoz/anaconda/lib/R/bin/R

这个人做了,并将其添加到我的 .bash_profile ,但它没有工作。我甚至做了一个 .bashrc ,但是在添加行之后,它仍然没有工作(我来源

I tried doing what this guy did and added this to my .bash_profile but it didn't work. I even made a .bashrc but it still didn't work (I sourced both after I added the lines)

导出RSTUDIO_WHICH_R = / Users / jespinoz / anaconda / bin / R

如何告诉RStudio使用R来自Anaconda的版本

不幸的是, anaconda https://docs.continuum.io/anaconda/ide_integration

推荐答案

只要哪个R 显示一个工作的R解释器(如果您已经安装了 r package from conda 并激活您的环境),然后启动 rstudio 来自同一个环境应该把它拿起来很好。

So long as which R shows up a working R interpreter (which it should do if you have installed the r package from conda and activated your environment) then launching rstudio from that same environment should pick it up just fine.

对于一个测试,在 ArchLinux ,我构建并安装了: https://aur.archlinux。 org / packages / rstudio-desktop-git /

然后强制删除R解释器( pacman -Rdd r ),然后安装 r conda conda install -crr ),它工作正常。然后,我关闭了我的终端并打开了一个新的(所以正确的 conda 环境未被激活,并使用以下命令成功启动RStudio: code> RSTUDIO_WHICH_R = / home / ray / r_3_3_1-x64-3.5 / bin / R rstudio

.. then force removed the R interpreter (pacman -Rdd r), then installed r from conda (conda install -c r r) and it worked fine. I then closed my terminal and opened a new one (so that the correct conda environment was not activated and successfully launched RStudio with the following command: RSTUDIO_WHICH_R=/home/ray/r_3_3_1-x64-3.5/bin/R rstudio

我认为关键是您的〜/ .bash_profile 〜/ .bashrc / code>仅在您运行 bash 时才提供。对于要设置的环境变量,以便您的桌面环境知道它们,在Linux上,应该将它们在〜/ .profile /etc/pam.d (您可能需要注销或关闭后那些更改),在OS X上,您应该查看 https://apple.stackexchange.com/q/57385

I think the crux is to launch RStudio from the right environment? Your ~/.bash_profile and ~/.bashrc are only sourced when you run bash. For environment variables to be set so that the your desktop environment knows about them, on Linux, you should put them in ~/.profile or else in /etc/pam.d (you may need to logout or shutdown after making those changes) and on OS X, you should check out https://apple.stackexchange.com/q/57385

这篇关于如何设置与RStudio一起使用的安装R版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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