python - 在 Windows 10 中安装后无法加载 'rpy2' 模块

标签 python r package rpy2

当我尝试通过 PyCharm 加载 rpy2 中的一些包(例如 importr)时,代码如下:

from rpy2.robjects.packages import importr

我收到以下错误消息

ValueError: r_home is None. Try python -m rpy2.situation

最佳答案

确保您拥有 2.1.5 及更高版本(它们修复了其中 r_home 的问题)。

如果情况并非如此,也许这会有所帮助(摘自 here ):

If calling initr() returns an error stating that R_HOME is not defined, you should either have the R executable in your path (PATH on unix-alikes, or Path on Microsoft Windows) or have the environment variable R_HOME defined. Should the initialization fail, a mismatch between the version of the R rpy2 was compiled against and the R rpy2 is run with should be investigated. The variable rpy2.rinterface.R_BUILD_VERSION contains information about the R version rpy2 was built against. rpy2 is relatively independent of R versions, but changes in the R C API might cause problems.

关于python - 在 Windows 10 中安装后无法加载 'rpy2' 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57988996/

相关文章:

r - 如何在不耗尽内存的情况下将非常大的 OpenStreetMap 文件划分为 R 中的较小文件?

haskell - 我的 Haskell 程序或库如何找到其版本号?

python - 如何使用特定规则在 Python 中按元素比较两个数组?

python - 如何设置Django的默认值 'on_delete=models.SET_DEFAULT'

python - 带有不应相加的文本项的 Pandas groupby

R- Shiny -DT : editting both Parent- child tables and updating each other

r - 在带有数据的同一图中绘制 GAM 预测值和 GAMM AR1 时出现问题

python - 使用 setup.py 时命名空间损坏并导致 AttributeError : module has no attribute

matlab - 如何正确命名和组织 MATLAB 文件类?

Python Config Parser 找不到部分?