用 markdown 写东西有一段时间了。前几天接触 Restructertext ,感觉基础版的 markdown 在写论文方面真心有点弱,于是找传说中牛逼的 pandoc markdown 看了看,真心牛逼啊。遂有安装个 pandoc 的冲动。
linux mint 15 mate
1 系统源里的pandoc长久没更新了,版本为1.10.1-1(2013-01-1),而官方最新版本为pandoc 1.12.0.2 (2013-09-20),更新很多。所以要安装最新版本,不能从系统源安装。
2 按照pandoc网站的All platforms安装指南,需要先安装Haskell platform。用
apt-cache show Haskell
搜索,发现linux mint 15中没有匹配的软件包。不知道是源服务器选的不对,还是基于ubuntu的linux mint却是做了比较大的修改,因为pandoc官网上说ubuntu源里是有Haskell platform。
3 于是求助谷歌之。本人只是linux的使用者,对linux系统构造软件包管理神马的却是不懂,但搜索一阵发现,好像linux mint中的Haskell编译环境叫个ghc。不过这是后知后觉的。前话是从几个帖子博客里发现很多大侠给出了同一种安装方法:
sudo apt-get install cabal-install cabal update cabal install pandoc
试了下之后,继续
pandoc --version
终端显示无此程序。郁闷。
4 再查官网,发现要把~/.cabal/bin放进PATH中,几个安装pandoc的博文中也这么说。不过按照黑魔法利器pandoc中介绍的方法,是要在在**.bashrc**里加上一句:
export PATH=/home/ypchen/.cabal/bin:$PATH
查了下.bashrc应该在**/home/用户名**文件夹下,可linux mint 15中又死活找不到了。继续google,找到了另外的办法,算是修改系统中的用户工作环境设置文件:
sudo pluma /etc/profile
文件最后一行添加:
export PATH=/home/ypchen/.cabal/bin:$PATH
再在etc文件夹下执行
source profile export
若添加成功的话,就能在PATH中看到添加进去的路径。
5 添加完PATH之后,再
pandoc --version
发现还是无此程序。
6 再次重新
cabal install pandoc
仔细一行一行看运行记录,发现安装出错,一个叫alex的程序没有安装,则依赖不完整,无法继续安装pandoc。
7 于是少啥安啥,
cabal install alex
成功。
8 再次安装pandoc,有显示错误,提示一个叫happy的程序没装,继续
cabal install happy
成功。
9 再安装pandoc,一路顺利,最后显示启动文件已创建在~/.cabal/bin文件夹中。再次
pandoc --version
显示
pandoc 1.12.0.2 Compiled with texmath 0.6.4, highlighting-kate 0.5.5. Syntax highlighting is supported for the following languages: actionscript, ada, 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, roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml Default user data directory: /home/bode/.pandoc 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.
10 哈哈,总算安装好了。再加上pandoc的引文工具包:
cabal install pandoc-citeproc
至此,算是把 pandoc 装好了。由于安装过程中遇到的各种麻烦问题(起码对于我这个菜鸟),当看到终端显示 pandoc 的最新版本号时,真心兴奋啊。所以还没使用 pandoc ,就干净趁热记录下安装过程。不知道用起来会出现啥麻烦。不过自己动手解决掉问题才是玩 linux 的乐趣之一吧。
本文作者:tsingk
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
预览: