如何告诉RStudio使用Anaconda的R版本 [英] How to tell RStudio to use R version from Anaconda
问题描述
我在Mac OS X优胜美地上安装了anaconda和conda软件包R. 当我输入
I have installed anaconda and the conda package R on my mac os x yosemite. When I type
which R
在我的终端中,我得到以下输出
in my terminal, I get the following output
/Users/giovannisoldi/anaconda/bin/R
,因此它实际上是链接到正确的版本.但是,当我打开RStudio时,可以看到R的旧版本位于
so it is actually linking to the right version. However, when I open RStudio, I can see that the old version of R located in
/Library/Frameworks/R.framework/Versions/2.15/
仍在使用.我尝试使用以下命令链接到Anaconda中的R的当前版本:
is still used. I tried to link to the current version of R in Anaconda, with the following command:
ln -sfhv /Users/giovannisoldi/anaconda/bin/ /Library/Frameworks/R.framework/Versions/Current
但是,通过这种方式,RStudio抱怨找不到R.
However, by doing this RStudio complains that it can't locate R.
有没有办法解决这个问题?
Is there a way to solve this issue?
推荐答案
这是我的操作方式:
which R
/Users/admin/anaconda/bin/R
在我的~/.bashrc
(或您的~/.bash_profile
)中,我输入了以下内容:
In my ~/.bashrc
(or your ~/.bash_profile
) I put this:
export RSTUDIO_WHICH_R=/Users/admin/anaconda/bin/R
然后source ~/.bashrc
(现在您必须从终端打开RStudio),您可以输入
(you now have to open RStudio from the terminal) finally, you can type
rstudio
或者您可以再次使用alias rstudio='open -a RStudio .'
编辑~/.bashrc
,现在rstudio
命令将在当前目录中打开RStudio.
or you can, again, edit your ~/.bashrc
with alias rstudio='open -a RStudio .'
and now the rstudio
command will open RStudio in your current dir.
这篇关于如何告诉RStudio使用Anaconda的R版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!