作为一名伪统计学爱好者,不得不装R软件...
于是ctrl +alt+T 打开终端,输入
- sudo apt-get install R-base-core
- R
...我去,我惊讶了
- R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
- Copyright (C) 2013 The R Foundation for Statistical Computing
- Platform: i686-pc-linux-gnu (32-bit)
于是乎....打开最近的镜像下载源码..
这个是 R-3.1.1 的source code.下载后解压....解压命令自行百度或嘿嘿...拖拽也成
然后下面是编译安装的过程.
源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install)
配置相关的知识可以看这里
1.配置
cd 切到源码文件夹下,输入
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib
其中 /home/pc/program/R-3.1.1 是要安装到的路径.
网上有人说此处会提示
- “configure: error: No F77 compiler found”
原因是没有安装gfortran,可以执行
- sudo apt-get install gfortran
安装一下.
我的提示是
- configure: error: --with-x=yes (default) and X11 headers/libs are not available
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib --with-readline=no --with-x=no
- sudo apt-get install libreadline6-dev
- sudo apt-get install libxt-dev
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib
但会有一大堆warning....类似如下:
- configure: WARNING: you cannot build DVI versions of the R manuals
- configure: WARNING: you cannot build DVI versions of all the help pages
- configure: WARNING: you cannot build info or HTML versions of the R manuals
- configure: WARNING: you cannot build PDF versions of the R manuals
- configure: WARNING: you cannot build PDF versions of all the help pages
但是具体需要哪些包...这让人很捉急....
于是Google之,查CRAN官网文档,发现在这个位置有这么一个存在,这段话是这么说的:(篇幅所限,只截取最关键部分)
To make these (with ‘fullrefman’ rather than ‘refman’), use
make pdf to create PDF versionsmake info to create info files (not ‘refman’ nor ‘fullrefman’).
You will not be able to build any of these unless you havemakeinfo version 4.7 or later installed, and for PDF you must have texi2dvi and texinfo.tex installed (which are partof the GNU texinfo distribution but are, especiallytexinfo.tex, often made part of the TeX package inre-distributions).
The PDF versions can be viewed using any recent PDF viewer: they havehyperlinks that can be followed. The info files are suitable forreading online with Emacs or the standalone GNU infoprogram. The PDF versions will be created using the paper size selectedat configuration (default ISO a4): this can be overridden by settingR_PAPERSIZEon the make command line, or setting R_PAPERSIZE in theenvironment and using make -e. (If re-making the manuals fora different paper size, you should first delete the filedoc/manual/version.texi. The usual value for North America wouldbe ‘letter’.)
那么,我们再来看一下这个makeinfo,textinfo 和 texinfo.tex,
sudo apt-get install makeinfo..提示没有找到软件包,
- sudo apt-get install texinfo
有这个软件包名,安装结束终端输入
- makeinfo --help
才发现,texinfo中包含了makeinfo,到此你可能认为这样可以了,终于可以编译生成文档了,或许你可以,当然我重装系统前也可以....
再次执行
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib
- configure: WARNING: you cannot build PDF versions of the R manuals
- configure: WARNING: you cannot build PDF versions of vignettes and help pages
再次翻看那部分英文说明,确实没错啊,编译 pdf 需要texi2dvi,但是texi2dvi是在texinfo中的,
然后我怏怏地执行了一下
- texi2dvi --help
- You don't have a working TeX binary installed, but the texi2dvi script
- can't proceed without it. If you want to use this script, you have to
- install some kind of TeX, for example TeX Live Debian packages. You can do
- that with this command:
- apt-get install texlive
安装完texlive,然后重新执行
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib
- configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally
应该是安装一个就可以的,试了一下果然如此.
在CTAN搜索 inconsolata ,找到了inconsolata 包的下载地址
texlive 默认安装位置后sty 存放的位置为:/usr/share/texlive/texmf-dist/tex/latex
将上述下载的压缩包整个文件夹解压到 上述目录,需要sudo权限才能移动到该目录,如果命令用的不好,可以执行
- sudo nautilus
然后刷新一下 sty 就好.
- sudo mktexlsr
- sudo texhash
- ./configure --prefix=/home/pc/program/R-3.1.1 --enable-R-shlib
- R is now configured for i686-pc-linux-gnu
- Source directory: .
- Installation directory: /home/pc/program/R-3.1.1
- C compiler: gcc -std=gnu99 -g -O2
- Fortran 77 compiler: gfortran -g -O2
- C++ compiler: g++ -g -O2
- C++ 11 compiler: g++ -std=c++11 -g -O2
- Fortran 90/95 compiler: gfortran -g -O2
- Obj-C compiler:
- Interfaces supported:
- External libraries:
- Additional capabilities: PNG, JPEG, NLS
- Options enabled: shared R library, shared BLAS, R profiling
- Recommended packages: yes
2.编译
- make
3.安装
- make install
注:以上命令执行时大部分需要在R源码文件夹目录下执行.当然如果工作目录一直保持在源码目录,也是可以的.
最终修成正果



雷达卡






京公网安备 11010802022788号







