系统路径与Sys.getenv('PATH') [英] System Path vs. Sys.getenv('PATH')

查看:480
本文介绍了系统路径与Sys.getenv('PATH')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个相当琐碎的问题,但是现在让我感到困惑的是一段时间.当我安装通用文档转换器pandoc并将其添加到我的路径时,一切都开始了.因此,当我在Mac OS X的默认终端上执行echo $PATH时,它显示pandoc并且可以执行它.

This might turn out to be a rather trivial question, but has me baffled for quite some time now. It all started when I installed the universal document converter pandoc and added it to my path. So when I do echo $PATH on the default terminal on my Mac OS X, it shows pandoc and I am able to execute it.

但是,当我尝试使用system(pandoc --version)在R会话中调用同一文件时,它无法识别pandoc.进一步检查发现system('echo $PATH')返回的路径与我在终端上返回的路径不同.

However, when I tried invoking the same in an R session using system(pandoc --version), it could not recognize pandoc. Further checking revealed that system('echo $PATH') does not return the same path that I got on the terminal.

任何人都可以帮助我解决所发生的事情吗?我喜欢在RStudio上完成所有工作,因此,如果我可以直接从内部使用pandoc,则更喜欢.因此,需要弄清楚这一点.

Can anyone help me with what is going on? I like to do all my work on RStudio, and hence would prefer if I can use pandoc directly from within. Hence the need to figure this out.

推荐答案

R和bash(无疑是Rstudio)各自创建了单独的环境. Terminal.app使用其自己的默认PATH设置启动bash会话.当Simon Urbanek最近回答了这个问题时,他向提问者介绍了R-Mac-FAQ 12.19.他的完整回应是在R-SIG-MAC档案中.在我的邮件客户端上,该邮件的主题行为Re:[R-SIG-Mac] PATH,日期为2012年1月30日.他还将发问者转到:

R and bash ( and undoubtedly Rstudio) each create separate environments. The Terminal.app starts a bash session with its own default PATH settings. When Simon Urbanek recently answered this question, he referred the questioner to the R-Mac-FAQ 12.19. His full response is in the R-SIG-MAC archives. On my mail client it appears with a subject line Re: [R-SIG-Mac] PATH and is dated January 30, 2012. He also referred the questioner to: http://developer.apple.com/library/mac/#qa/qa1067/_index.html

正如?EnvVar告诉您的:"Sys.getenvSys.setenv在R会话中读取和设置环境变量".但是那时您似乎已经意识到这些功能.

As ?EnvVar tells you: "Sys.getenv and Sys.setenv to read and set environmental variables in an R session." But then you already seem to be aware of those functions.

这篇关于系统路径与Sys.getenv('PATH')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆