解决方案您可以在笔记本开头的代码单元中添加.libPaths('path_where_your_packages_are'),以告诉jupyter程序包在哪里.对我来说,这是.libPaths('~/R/win-library/3.2')(来自Discnerd的变通方法,他提出了这个问题在github上). 要找出软件包的路径,只需在R中安装一个随机软件包,然后等待将该位置打印到控制台即可. 更多详细信息(可能特定于我的系统/安装):在R中运行.libPaths()时,我得到2个位置:一个位置需要写入管理员权限,而一个位置则不需要写入管理员权限.通过R安装的软件包位于不需要管理员权限的位置,而jupyter则查看需要管理员权限的位置. First let me preface this with the disclaimer that I'm new to R, but a longtime Python power user. Given that I love the conda ecosystem and the Jupyter notebook, I'm trying to set them up as my R development environment as well.So using the instructions at: https://www.continuum.io/blog/developer/jupyter-and-conda-r I've set up a Jupyter Notbook that using an RKernel that should be hitting the installation of R installed in my Anaconda folder (I would think anyway).Getting it setup was easy peasy and everything is working great for standard R stuff but my analysis requires some R libraries that are not available in r-essentials channel. No problem, I think I know how to install an R library. I go to "C:\Anaconda\R\bin\x64\Rgui.exe" and install rgdal, dismo, and some other packages. To check my work I looked in C:\Anaconda\R\library and there they are. But when I run a jupyter notebook from the Anaconda command prompt. And start a new R notebook I get a "Error in library(dismo): there is no package called 'dismo'" Wait a sec, I run a ".libPaths()" from the notebook and it looks like its pointing 解决方案 You can add .libPaths('path_where_your_packages_are') in a code cell at the beginning of your notebook to tell jupyter where your packages are. For me that was .libPaths('~/R/win-library/3.2') (work-around from discnerd who filed this issue on github). To find out the path to your packages, just install a random package in R and wait for the location to be printed to the console. More details (likely specific to my system/installations): When running .libPaths() in R, I got 2 locations: one for which admin rights were required for writing, and one for which admin rights were not required for writing. While packages installed through R land in the location where admin rights are not required, jupyter looks at the location where admin rights are required. 这篇关于在Anaconda Jupyter笔记本中为RKernel指定R库路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-22 21:19