嗨,我刚刚下载了 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/