gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 20:23:37 29 4
gpt4 key购买 nike

当我尝试通过 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com