Skip to main content
 首页 » 编程设计

python之sh : Rscript: command not found

2025年02月15日12txw1958

从 PyDev 中的 Python 脚本调用时,

Rscript 不起作用。

这是有罪的代码:

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

错误:

sh: Rscript: command not found 

请您参考如下方法:

在 mac 上,命令只是 system:

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

(我的 test.R(在我的工作目录中)是先前问题遗留下来的。)Rscript 应该在“常规”安装期间从 CRAN dmg 在“通常”位置安装,因为您看起来是和我的是。