R无法识别Pandoc Linux Mint [英] R doesn't recognize Pandoc Linux Mint

查看:108
本文介绍了R无法识别Pandoc Linux Mint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问了一个相关问题:检查是否已安装程序

I asked a related question: check if a program is installed

但是要避免回答,直到我在所有三个系统上为我自己测试了解决方案为止.我可以在Windows机器上的R中使pandoc正常运行,但在linux上,我会从R终端得到每种方法的错误/响应:

But am refraining from answering until I've tested the solutions for myself on all three systems. I can get pandoc to work from within R on a windows machine but on linux I get this error/response for each method from the R terminal:

1:

> system('pandoc -v')
sh: 1: pandoc: not found

2:

> myPaths <- c("pandoc", 
+              "~/.cabal/bin/pandoc", 
+              "~/Library/Haskell/bin/pandoc", 
+              "C:\\PROGRA~1\\Pandoc\\bin\\pandoc") 

> Sys.which(myPaths)
                           pandoc               ~/.cabal/bin/pandoc 
                               ""   "/home/tyler/.cabal/bin/pandoc" 
     ~/Library/Haskell/bin/pandoc C:\\PROGRA~1\\Pandoc\\bin\\pandoc 
                               ""                                "" 

3:

> Sys.which("pandoc")
pandoc 
"" 

您可能会认为我没有在路径上安装pandoc,但我相信是的.在干净的终端会话中:

You may think I don't have pandoc installed and on the path but I believe I do. From a clean terminal session:

> tyler@trinker ~ $ echo $PATH
> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/tyler/.cabal/bin

tyler@trinker ~ $ pandoc -v
pandoc 1.10.1
Compiled with citeproc-hs 0.3.7, texmath 0.6.1.3, highlighting-kate 0.5.3.6.
Syntax highlighting is supported for the following languages:
    Actionscript, Ada, Alert, Alert_indent, Apache, Asn1, Asp, Awk, Bash,
    Bibtex, Boo, C, Changelog, Clojure, Cmake, Coffee, Coldfusion, Commonlisp,
    Cpp, Cs, Css, Curry, D, Diff, Djangotemplate, Doxygen, Doxygenlua, Dtd,
    Eiffel, Email, Erlang, Fortran, Fsharp, Gnuassembler, Go, Haskell, Haxe,
    Html, Ini, Java, Javadoc, Javascript, Json, Jsp, Julia, Latex, Lex,
    LiterateCurry, LiterateHaskell, Lua, Makefile, Mandoc, Matlab, Maxima,
    Metafont, Mips, Modula2, Modula3, Monobasic, Nasm, Noweb, Objectivec,
    Objectivecpp, Ocaml, Octave, Pascal, Perl, Php, Pike, Postscript, Prolog,
    Python, R, Relaxngcompact, Rhtml, Ruby, Scala, Scheme, Sci, Sed, Sgml, Sql,
    SqlMysql, SqlPostgresql, Tcl, Texinfo, Verilog, Vhdl, Xml, Xorg, Xslt, Xul,
    Yacc, Yaml
Copyright (C) 2006-2013 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

如何使Linux Mint上的R识别pandoc?(我是Linux的新手)

How can I make R on Linux Mint recognize pandoc? (I'm newer to Linux)

推荐答案

我也遇到了问题.我也通过cabal安装了pandoc.如果您通过apt-get安装,应该不会有问题.如果我是从终端启动R的,那没有问题,但是尝试从RStudio中检测pandoc会带来一些麻烦.原因是RStudio不会读取您的bash环境变量,因此,如果您在.bashrc中修改路径,RStudio不会检测到它.一种解决方案是改为通过.profile修改路径.

I was having issues with this as well. I installed pandoc via cabal as well. If you install via apt-get there shouldn't be an issue. If I launched R from a terminal I had no issues but attempting to detect pandoc from within RStudio gave some troubles. The reason is that RStudio doesn't read in your bash environment variables so if you modify the path in .bashrc RStudio won't detect that. A solution is to modify the path via .profile instead.

将其添加到.profile文件的底部,并删除.bashrc文件中的路径修改,您应该能够从R内部识别pandoc.

Add this to the bottom of your .profile file and remove the path modfication in your .bashrc file and you should be able to recognize pandoc from within R.

if [ -d "$HOME/.cabal/bin" ] ; then
    PATH="$PATH:$HOME/.cabal/bin"
fi

这篇关于R无法识别Pandoc Linux Mint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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