我在 LyX 2.0.5.1 和 RStudio 0.97.318 上使用最新版本。我已经在 R 中安装了 knitr,我的 /usr/bin/Rscript 在 LYX 的 PATH 前缀中,但我仍然无法运行示例文件 knitr.lyx。我得到的错误是:
An error occurred while running:
Rscript --verbose --no-save --no-restore
"/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R"
"/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL9170/lyx_tmpb...
我将 lyxknitr.R 更改为官方引用中列出的其他版本,它也不适用于它们。当我在 Windows 7 上做类似的事情时,它运行正常。我试图重新安装lyx,它没有帮助。我还可以做些什么?
谢谢!
更新:我在 R 中安装了 stringer 包,重新配置,但 Lyx 仍然给出错误:
12:24:25.747: Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.Rnw" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.tex" ISO-8859-15 "/Users/Natasha/Stats315b/HW1/"
12:24:25.749: running
12:24:25.758: '/Library/Frameworks/R.framework/Versions/2.15/Resources/bin/R --slave --no-restore --no-save --no-restore --file=/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R --args /var/folders/ls/
12:24:25.759: mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/knitr.Rnw /var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/knitr.tex ISO-8859-15'
12:24:25.759:
12:24:25.946: Error in loadNamespace(i, c(lib.loc, .libPaths())) :
12:24:25.951: there is no package called 'stringr'
12:24:25.957: Error: package/namespace load failed for 'knitr'
12:24:25.957: Execution halted
Running: Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.Rnw" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.tex" ISO-8859-15 "/Users/Natasha/Stats315b/HW1/"
support/Systemcall.cpp (273): Systemcall: 'Rscript --verbose --no-save --no-restore "/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.Rnw" "/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpbuf3/""knitr.tex" ISO-8859-15 "/Users/Natasha/Stats315b/HW1/"' finished with exit code 1
Error: Cannot convert file
----------------------------------------
An error occurred while running:
Rscript --verbose --no-save --no-restore
"/Applications/LyX.app/Contents/Resources/scripts/lyxknitr.R"
"/var/folders/ls/mbs_stj505lc25gj2m7h5h100000gn/T/lyx_tmpdir.JL2777/lyx_tmpb...
12:24:27.545: Error while previewing format: pdf2
我不必在 Windows 下安装 stringr,它工作正常。感谢帮助!