操作系统:Ubuntu的12R:不能在Ubuntu安装与install.packages()封装
[R版本:3.3.1
当我尝试安装由install.packages包()显示以下错误:
install.packages("cluster")
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot download all files); using local file '/opt/R/lib/R/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository http://mirrors.opencas.cn/cran/src/contrib:
cannot open URL 'http://mirrors.opencas.cn/cran/src/contrib/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'Couldn't connect to server'
2: package ?.luster?.is not available (for R version 3.3.1)
我已经尝试过其他的镜子,但仍然简化版,工作。看来R无法连接到网络。在我的公司中,需要通过代理连接网络。因此,我已通过编辑〜/ .Renviron R上的代理,这已得到遏制:
> Sys.getenv("http_proxy")
[1] "http://proxy.zte.com.cn:80/"
> Sys.getenv("https_proxy")
[1] "https://proxy.zte.com.cn:80/"
> Sys.getenv("ftp_proxy")
[1] "ftp://proxy.zte.com.cn:80/"
但它仍然无法正常工作。然后,我测试R是否可以通过以下函数连接到网络,并返回FALSE。
library('curl')
has_internet <- function(){
+ !is.null(curl::nslookup("r-project.org", error = FALSE))
+ }
> has_internet()
[1] FALSE
有想法有任何人这件事吗?非常感谢您的关注。
您对无法运行的内容使用“运行代码段”。这是JS。 –
你说的问题只是网络访问。对服务器故障进行故障排除是最容易的,但是您可以做的一些诊断是尝试从终端ping Google.com,如果它能正常工作,则只需复制终端使用的设置即可。此外,请查看此主题中提到的各种设置,并查看是否有任何工作为您提供参数“方法”(https://support.rstudio.com/hc/en-us/community/posts/200660383-Proxy-settings –
)在使用'download.file'中的方法的'install.packages'中,根据'?download.file',你可以将它设置为“wget”或“curl”,这些使用系统调用,所以如果这些工作正常你的系统,这应该绕过代理。 – Shape