python - 如何设置 rpy2?

标签 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.

最佳答案

This might be because R.exe is nowhere in your Path

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

关于python - 如何设置 rpy2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3376867/

相关文章:

python - 如何从一个表中删除所有出现的数字,并从另一个表中查找数字?

r - 在 R 中使用 dplyr 过滤时,为什么过滤掉的变量级别仍保留在过滤数据中?

r - 如何从 Shiny 的模块调用 Shiny 的模块?

r - 在另一个角上绘制一个图形

python - 为什么 `function` 不是 Python 中的关键字?

python,用字典替换if/elif

python - 如何按两个元素对字典进行排序,只反转一个

python - 在带有python2.6的windows7上使用python dragonfly的问题

r - R 中的 fread 错误 - 字符串 : '\0' 中嵌入 nul

r - 创建变量数量不等的计数表