简体   繁体   English

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

[英]Can't load the 'rpy2' module after installation in Windows 10

When I try to load through PyCharm some packages in rpy2 like importr with the following code: 当我尝试通过PyCharm加载rpy2某些程序包时,例如importr ,其代码如下:

from rpy2.robjects.packages import importr

I get the following error message 我收到以下错误消息

ValueError: r_home is None. ValueError:r_home为“无”。 Try python -m rpy2.situation 试试python -m rpy2.situation

Make sure you have release 2.1.5 and up (they fix issues with r_home in it). 确保您具有版本2.1.5及更高版本(它们已解决r_home的问题)。

If this is not the case, maybe this could help (taken from 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. 如果调用initr()返回一个错误,指出R_HOME ,则您应该在路径中具有R可执行文件(unix- R_HOME上的PATH或Microsoft Windows上的Path )或定义环境变量R_HOME 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. 如果初始化失败,则应调查R rpy2版本与R rpy2运行版本之间的不匹配。 The variable rpy2.rinterface.R_BUILD_VERSION contains information about the R version rpy2 was built against. 变量rpy2.rinterface.R_BUILD_VERSION包含有关rpy2所针对的R版本的信息。 rpy2 is relatively independent of R versions, but changes in the RC API might cause problems. rpy2相对独立于R版本,但是RC API的更改可能会引起问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM