使用代理连接的Rstudio问题下载包

时间:2017-05-17 16:00:00

标签: proxy server package rstudio

我在互联网上寻找解决问题的2天没有成功。 我在工作中下载了Rstudio,并尝试安装一些软件包。

当我举例说R:

> install.packages("readxl")

返回

Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://cran.rstudio.com/src/contrib:
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'    
Warning in install.packages :
  package ‘readxl’ is not available (for R version 3.4.0)    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://cran.rstudio.com/src/contrib:
  cannot open URL 'http ://cran.rstudio.com/src/contrib/PACKAGES'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'    
Warning in install.packages :
  package ‘readxl’ is not available (for R version 3.4.0)    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://cran.rstudio.com/bin/windows/contrib/3.4:
  cannot open URL 'http ://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES.rds': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES.gz': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES': HTTP status was '407 Proxy Authorization Required'    
Warning in install.packages :
  unable to access index for repository http ://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
  cannot open URL 'http ://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'

我查看了互联网,问题似乎是与我公司代理的连接(每次连接到互联网时都要输入用户名和密码)

我尝试添加C:\ Users \您的用户名\ Documents中的.Renviron文件,并在Internet上找到以下代码:

options(internet.info = 0)   
http_proxy = https:// user_id:password@your_proxy:your_port    
http_proxy_user = user_id:password

我替换了user_id和密码
我找到了我的代理:start> run> cmd> ipconfig它的格式为xxxxx.xxx.ca(有些字母替换了' x')
而对于我的端口我放了8080

我也尝试直接下载包的zip文件,但它既不起作用。

我迫切希望找到解决方案

1 个答案:

答案 0 :(得分:0)

您是否尝试将<?php $connect = mysqli_connect( "localhost", "user", "password", "db" ); $sql = "SELECT * FROM current_rates WHERE date = '2017-05-01'"; $result = mysqli_query( $connect, $sql ); $Json_array = array(); while ( $row = mysqli_fetch_assoc( $result ) ) { $Json_array[] = $row; } /* echo "<pre>"; print_r($Json_array); echo "<pre>"; */ $finalJson['lenders'] = $Json_array; echo json_encode( $finalJson ); ?> 放入.Renviron