您好,登錄后才能下訂單哦!
1、系統環境 :CentOS release 6.8 (Final)
2、安裝包下載: wget https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz
3、解壓并安裝:
tar xf R-3.5.0.tar.gz
./configure --enable-R-shlib=yes --with-tcltk --prefix=/usr/local/R
(報錯):
checking if bzip2 version >= 1.0.6... no
checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
(煎熬的過程從此開始,各種依賴,各種報錯,R語言是不是不想讓大家好好使用,真是服了。)
4、總結安裝方法:
4.1 下載依賴包:
bzip2-1.0.6 wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
xz-5.2.2 wget http://tukaani.org/xz/xz-5.2.2.tar.gz
pcre-8.38 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
curl-7.47.1 wget --no-check-certificate https://curl.haxx.se/download/curl-7.47.1.tar.gz
4.2 解壓安裝包:
tar xf bzip2-1.0.6.tar.gz -C /usr/local/
tar xf xz-5.2.2.tar.gz -C /usr/local/
tar xf pcre-8.38.tar.gz -C /usr/local/
tar xf curl-7.47.1.tar.gz -C /usr/local/
tar xf R-3.5.0.tar.gz -C /usr/local/
4.3 創建依賴包安裝目錄(上面所有的依賴包都要安裝到這個目錄,這一步很重要)
mkdir /usr/local/packages
4.4 首先安裝依賴包,順序不能亂
cd bzip2-1.0.6/
vim Makefile (修改Makefile,將第24行的CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) 改為 CFLAGS=-fPIC -Wall -Winline -O2 -g $(BIGFILES),就是在-Wall 前面加上-fPIC )
make -f Makefile-libbz2_so
make clean
make
make install PREFIX=/usr/local/packages()
cd ../xz-5.2.2/
./configure --prefix=/usr/local/packages
make -j4
make install
cd ../pcre-8.38/
./configure --enable-utf8 --prefix=/usr/local/packages
make -j4
make install
cd ../curl-7.47.1/
./configure --prefix=/usr/local/packages
make -j4
make install
4.5 修改環境變量(根據實際安裝路徑修改)
export PATH=/usr/local/packages/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH
export CFLAGS="-I/usr/local/packages/include"
export LDFLAGS="-L/usr/local/packages/lib"
4.6 安裝R-3.5.0
cd ../R-3.5.0/
mkdir builddir
cd builddir/
mkdir /usr/local/packages/R-3.5.0
../configure --prefix=/usr/local/packages/R-3.5.0
make
make install
make pdf(生成packages的pdf幫助文檔,若無linux無圖形界面,則不需要進行此步驟)
修改環境變量 (根據實際安裝路徑修改)
echo 'export PATH=/usr/local/packages/R-3.5.0/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
4.7 測試
#R
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。