首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么curl在R中返回HTTP错误407?

为什么curl在R中返回HTTP错误407?
EN

Stack Overflow用户
提问于 2022-07-14 14:59:53
回答 1查看 360关注 0票数 1

我试图在R4.2.0(ubuntu20.04)中使用install.packages(“獾”)。但是当它下载一些文件时,它说错误407:

代码语言:javascript
复制
.....
* installing *source* package 'gert' ...
** package 'gert' successfully unpacked and MD5 sums checked
** using staged installation
> curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh","get-libgit2-linux.sh")
Error in curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh",  : 
  Received HTTP code 407 from proxy after CONNECT
Execution halted
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
......

然而:

  • 所有其他软件包都安装得非常好。
  • 这个精确的文件也可以在浏览器和命令行curl https://r-lib.github.io/gert/get-libgit2-linux.sh中从根和用户下载。
  • 当我在R提示符中输入curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh","index.html")时,这个文件会产生同样的错误。
  • 但是curl::curl_download("https://github.com","index.html")工作得很好。
  • 但是curl::curl_download("https://google.com","index.html")给出了同样的错误407。
  • 当我使用Sys.setenv(https_proxy = )Sys.setenv(https_proxy_user = )设置代理服务器时,它无助于使用curl下载上述文件,而且,安装甚至在更早的阶段结束:
代码语言:javascript
复制
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
  cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
Warning message:
package 'badger' is not available for this version of R
  • 当我在bash中取消设置https_proxyhttp_proxy变量时,安装程序会冻结下载索引,因为我们公司使用代理服务器,没有代理服务器就无法访问internet:
代码语言:javascript
复制
> install.packages("badger")
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
^C
  • 当我在bash中撤消代理设置并在R中设置它们时,curl调用将产生相同的错误407,安装如下:
代码语言:javascript
复制
> install.packages("badger")
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
Error in readRDS(dest) : error reading from connection

它会是什么,我怎样才能让卷发工作?或者如何在没有卷曲的情况下安装上述软件包?

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-10-03 06:59:53

错误指示,由于某些原因,代理设置不正确或代理设置过期。后者是我在OpenSuse上的情况。

解决方案:

  • 通过运行yast,通过终端进行检查。这将打开终端UI视图,在该视图中,您可以导航到安装并测试“网络代理”和“网络代理用户”设置。

  • 交替:Yast创建一个名为~/.curlrc的文件。编辑这个,在这里设置您的代理和代理用户。打开新的bash/会话以验证更改。

测试使用,终端上的zypper refresh命令。

注意事项(可选):其他可能的捕获-一些旧的回购-URL是无法到达的。在您将zypper更新为zypper update之前,可能需要禁用它。例如:

代码语言:javascript
复制
$ ls /etc/zypp/repos.d/
$ vi suse_update.repo

<编辑,将enabled=1替换为enabled=0__>

4 4MoreInfo

使用Curl更新进程不访问配置的代理服务器

回购文件中的Baseurl条目

SUSE Linux Enterprise :如何手动设置代理

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72982641

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档