我使用的是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,它运行正常。谢谢你的帮助!