R 通过 Ubuntu 中的代理连接 [英] R connect via proxy in Ubuntu

查看:45
本文介绍了R 通过 Ubuntu 中的代理连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 12.04 上安装了 RStudio 0.97.168.当我尝试安装 gstat 库时,出现以下错误

I had installed RStudio 0.97.168 on Ubuntu 12.04. When I try to install gstat library I get the below error

install.packages("gstat", dependencies=TRUE)

Warning in install.packages :
  cannot open: HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
  cannot open: HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
  unable to access index for repository http://software.rc.fas.harvard.edu/mirrors/R/src/contrib
Warning in install.packages :
  package ‘gstat’ is not available (for R version 2.14.1)

我看到了像 --intenetsetInternet(TRUE) 这样的解决方案,它们只适用于 Windows 操作系统.

I saw solutions like --intenet and setInternet(TRUE) which are only applicable for Windows OS.

请提供有关我需要做出哪些更改以支持我的大学代理的帮助?

Please provide help on changes I need to make to get behind my university proxy?

推荐答案

您应该能够在 R 会话中使用以下内容:

You should be able to use the following in your R session:

Sys.setenv(http_proxy="http://user:pass@proxy.dom.com:8080/")

(显然,替换为您的用户名、密码、代理服务器和端口.)

(Obviously, replace with your username, password, proxy server, and port.)

在您第一次尝试下载任何东西之前完成这一点很重要——换句话说,最好在 R 会话开始时完成.从位于 ?download.file 的帮助页面:

It's important that this is done before you first try to download anything--in other words, done preferably at the start of an R session. From the help page at ?download.file:

必须在首次使用下载代码之前设置这些环境变量:以后不能通过调用 Sys.setenv 来更改它们.

These environment variables must be set before the download code is first used: they cannot be altered later by calling Sys.setenv.

也有一些方法可以使此更改永久",但如果您使用的是笔记本电脑或使用多个 Internet 连接(其中一些需要通过代理服务器进行访问,而另一些则不需要),这可能会带来不便.

There are ways to make this change "permanent" too, but that might be inconvenient if you are working on a laptop or working with multiple internet connections, some of which requires access via a proxy server, and some which don't.

这篇关于R 通过 Ubuntu 中的代理连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆