配置方式

详见:
https://www.r-bloggers.com/2018/03/multiple-versions-of-r/

问题及解决

第一步,apt源更新

问题:
c compiler cannot create executables
xgcc: error: unrecognized command line option ‘-V’ xgcc: fatal error: no input files
真正的错误并不在这里,而是在最后一个错误出现的地方

首先更新apt源,切记是ubuntu系统匹配的源,不然会安装不上,以及冲突

第二步,安装编译

更新好后,安装build-essential

缺乏breadline

安装R前,建议先安装这些:

  1. sudo apt-get install build-essential
  2. sudo apt-get install fort77
  3. sudo apt-get install xorg-dev
  4. sudo apt-get install liblzma-dev libblas-dev gfortran
  5. sudo apt-get install gcc-multilib
  6. sudo apt-get install gobjc++
  7. sudo apt-get install aptitude
  8. sudo aptitude install libreadline-dev

bzip2 library and headers are required

  1. sudo apt-get install libbz2-dev

pcre >= 8.20 library and headers are required

  1. apt install libpcre++-dev

libcurl >= 7.22.0 library and headers are required with support for https

  1. apt install libcurl4-openssl-dev

最后,java没有安装

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-20-04

大牛总结的R安装出现的各种问题

https://twilightbbs.wordpress.com/2017/07/04/compiling-cran-r-from-scratch-and-possible-workarounds/