如何设置rpy2?

时间:2010-07-31 04:55:34

标签: python r

您好,我只需下载rpy2和Python 2.6。当我尝试运行一些我在互联网上找到的示例代码时,我收到了这个错误。任何人都可以解释为什么会发生这种情况,我该如何解决?感谢。

import rpy2.robjects as RO

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import rpy2.robjects as RO
  File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line 12, in <module>
    import rpy2.rinterface as rinterface
  File "C:\Python26\lib\site-packages\rpy2\rinterface\__init__.py", line 22, in <module>
    "This might be because R.exe is nowhere in your Path.")
RuntimeError: Unable to determine R version from the registery.Calling the command 'R RHOME' does not return anything.
This might be because R.exe is nowhere in your Path.

1 个答案:

答案 0 :(得分:1)

  

这可能是因为R.exe无处可去   在你的路径

这听起来像一个很大的线索。检查Windows环境中%PATH%的值。我希望它包含R.EXE的位置(可能类似于C:\Programs\R\R-2.8.0\bin)。