从R控制台运行系统命令无法找到已安装的程序,因为升级到Mac OSX 10.10 [英] Running system command from R console cannot locate installed programs since upgrading to Mac OSX 10.10
问题描述
I have been having some weird issues with R (3.1.1) and RStudio (0.98.1079) and I suspect that it is due to the fact that these programs are not longer referencing the right places after I upgraded to Mac OSX 10.10.
尤其是,我似乎找不到在R控制台中使用system
命令运行的程序包.也就是说,在终端"窗口中运行man pdflatex
会产生PDFLATEX的帮助手册.但是,从R控制台运行system('man pdflatex')
会产生错误消息No manual entry for pdflatex.
In particular, I cannot seem to find packages that I know I have installed on my computer to run using the system
command in the R console. That is, running man pdflatex
in a Terminal window yields the help manual for PDFLATEX. However running system('man pdflatex')
from the R console yields the error message No manual entry for pdflatex.
自升级到Mac OSX 10.10以来,即使我重新安装了R,RStudio和MacTex,问题仍然存在.任何帮助将不胜感激!
The issue persists even though I reinstalled R, RStudio and MacTex since I upgraded to Mac OSX 10.10. Any help would be appreciated!
推荐答案
Yosemite有一个错误,其中某些环境变量(包括PATH
)在程序环境中以不同的值出现两次.例如,您可能会注意到Sys.getenv("PATH")
将显示一个PATH,而system("echo $PATH")
将显示一个完全不同的PATH.
Yosemite has a bug wherein some environment variables, including PATH
, appear twice in a program's environment with different values. For instance, you might notice that Sys.getenv("PATH")
will show you one PATH, and system("echo $PATH")
will show you an entirely different one.
我希望您的大多数问题都归因于此错误.
I expect that most of your problems are due to this bug.
您可以立即尝试以下几种解决方法:
There are a few workarounds you can try immediately:
-
您可以自己手动转发
PATH
.试试这个:
> system2("man", "pdflatex", env=paste0("PATH=", Sys.getenv("PATH")))
或者,您可以从终端启动RStudio:
Or, you can start RStudio from Terminal:
$ open /Applications/RStudio.app
R和RStudio工程师都在最近几天中实施了变通方法. R(从3.1.2版本开始)和RStudio(从0.98.1087版本开始)应该表现出预期的效果.
Both the R and RStudio engineers have implemented workarounds in the last few days. R (as of 3.1.2) and RStudio (as of 0.98.1087) should behave as you'd expect.
这篇关于从R控制台运行系统命令无法找到已安装的程序,因为升级到Mac OSX 10.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!