R CMD on Windows 7 Error - “R” is not recognized as an internal or external command,

前端 未结 7 1106
轻奢々
轻奢々 2020-11-29 07:56

I\'m exploring package building on Windows 7 but have been running into trouble after reaching the Command Prompt stage. The following thread appears to be on the same topic

7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 08:52

    I encountered a similar problem while trying to use SparkR from Windows Power Shell. Each time I would do ".\sparkR.cmd" (I was inside the folder containing this file), it would throw an error message like,

    cmd is not recognized as an internal and external command...blah...blah...blah.

    I solved the problem by adding "C:\Windows\System32" to my PATH.

    I restarted my system and then repeated the process and this time, I saw a new error,

    R is not recognized as an internal and external command...blah...blah...blah.

    I tried all sorts of approaches, including the ones mentioned above. NOTHING WORKED, I was probably wasn't efficient enough to make it work.

    Then I came across this place at code.google. I simply copied the R.bat onto a notepad, named it as R.bat. Kept it inside the folder where sparkR.cmd was located. For me it was,

    C:\Apache\spark-1.5.1-bin-hadoop2.6\bin\

    The I placed it on my PATH as :

    C:\Apache\spark-1.5.1-bin-hadoop2.6\bin\R.bat

    Restarted my laptop, opened my Power Shell as an administrator and typed :

    .\R.bat help

    It worked fine. Then I typed,

    .\sparkR.cmd

    and there it was.

    It worked.

    I hope it helps to people new to R. Thank you G. Grothendieck.

提交回复
热议问题