2010-07-31 64 views
1

嗨,我只是下載rpy2和Python 2.6。當我嘗試運行一些我在互聯網上找到的示例代碼時,我得到了這個錯誤。任何人都可以解釋爲什麼會發生這種情況,我該如何解決它?謝謝。如何設置rpy2?

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

這可能是因爲運行R.exe是無處 在你的路徑

這聽起來像一個大線索。檢查Windows環境中的%PATH%的值。我希望這包含R.EXE(可能類似於C:\Programs\R\R-2.8.0\bin)的位置。

+1

此頁面描述如何設置路徑:http://www.computerhope.com/issues/ch000549.htm – SiggyF 2010-07-31 22:53:41