CentOS下安裝R

來源:互聯網
上載者:User

標籤:style   class   blog   code   http   tar   

R的Windows版本有直接的安裝包,直接下載安裝很方便,但是對於CentOS6以上,不能直接通過yum 安裝R,需要自己編譯。

 

1. 在編譯之前,用yum安裝各種軟體

(1)安裝gcc

> yum install gcc

(2)安裝g++

> yum install gcc-c++  #否則報”configure: error: C++ preprocessor “/lib/cpp” fails sanity check”錯誤

(3)安裝gfortran 

> yum install gcc-gfortran。#否則報”configure: error: No F77 compiler found”錯誤

(4)安裝readline

> yum install readline-devel  #否則報”–with-readline=yes (default) and headers/libs are not available”錯誤

(5)安裝libXt

> yum install libXt-devel  #否則報”configure: error: –with-x=yes (default) and X11 headers/libs are not available”錯誤

 

2. download R的安裝包

我的版本是3.0.2,可以用命令:

> wget http://cran.rstudio.com/src/base/R-3/R-3.0.2.tar.gz

 

3. 解壓縮 R的安裝包

> tar -xzvf R-3.0.2.tar.gz

 

4. 修改設定檔

> cd R-3.0.2> ./configure –prefix=/安裝目錄-

 

5. 完成編譯安裝

如果不報錯的話(warning不算),就算成功了,接下來就可以直接執行命令:> make, 然後是> make install,可能在make的過程中會等待10幾分鐘

 

6. 測試進入R

接下來應該直接可以在shell裡直接用R進入R了,如果不可以的話,再用vi /etc/profile修改環境變數PATH路徑,增加:export PATH= $PATH:/usr/local/bin,最後別忘了source /etc/profile!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.