Search code examples
pythonrpython-2.7pydev

sh: Rscript: command not found


Rscript doesn't work when calling it from a Python script in PyDev.

Here's the guilty code:

os.system("Rscript --vanilla test.R")

And the error:

sh: Rscript: command not found

Solution

  • On a mac the command is just system:

    > system("Rscript --vanilla test.R")
    [1] " Your Name is    and  you are     years old"
    

    (My test.R (in my working directory) was left over from a prior question.) Rscript should have been installed during "regular" installation from the CRAN dmg in the "usual" place, as your appears to be and mine is.