简体   繁体   English

rmarkdown:手动指定 pandoc 路径?

[英]rmarkdown: specify manually pandoc path?

I have a rmarkdown document that I render regularly with rmarkdown::render我有一个 rmarkdown 文档,我使用rmarkdown::render定期渲染

It works fine on my computer (Windows) as I have RStudio installed, and it has setup automatically the path to pandoc.它在我的计算机(Windows)上运行良好,因为我安装了 RStudio,并且它自动设置了 pandoc 的路径。

However when I try to run it on my server (outside RStudio), it fails with error that pandoc is not found.但是,当我尝试在我的服务器上(在 RStudio 之外)上运行它时,它会失败并显示找不到 pandoc 的错误。

How can I set up manually the path the pandoc from my script?如何从我的脚本中手动设置 pandoc 的路径? Without changing the configuration on the server.无需更改服务器上的配置。

I have tried this but it doesn't work:我已经尝试过了,但它不起作用:

Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC_BIN/binaries/pandoc/pandoc.exe")

I suggest to set the system path for pandoc (Windows 10 instructions):我建议为 pandoc 设置系统路径(Windows 10 说明):
1. In the Start menu, search for "Edit the system environment variables" 1.在开始菜单中,搜索“编辑系统环境变量”
2. At this point, Windows may ask you for username + password (for a user with permission to change system settings) 2. 此时,Windows 可能会要求您输入用户名 + 密码(对于有权更改系统设置的用户)
3. Click "Environment Variables" button 3.点击“环境变量”按钮
4. In the lower part of the window ( System variables ), select the line with "Path" and click Edit 4.在窗口下部系统变量),选择带有“路径”的行,然后单击编辑
5. Add the path to the folder where pandoc.exe is, but not including "pandoc.exe" or a slash at the end 5.添加pandoc.exe所在文件夹的路径,但包括“pandoc.exe”或末尾的斜杠

Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC_BIN/binaries/pandoc/pandoc.exe")

That is actually almost correct, just omit the *.exe files, write the path only up to folder contain pandoc.exe这实际上几乎是正确的,只需省略 *.exe 文件,仅将路径写入包含 pandoc.exe 的文件夹

like this : Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC_BIN/binaries/pandoc")像这样: Sys.setenv(RSTUDIO_PANDOC="PATH_TO_MY_PANDOC_BIN/binaries/pandoc")

i believe this doesn't require admin rights我相信这不需要管理员权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM