第二步,在RStudio中输入:> file.edit('~/.Renviron')将打开一个空文件或一个具有现有代理设置的文件. (我的是空的).然后,我包括以下两个内容:(一些注意事项:我没有https_proxy设置,但是我仍然需要在https_proxy设置中使用http_proxy详细信息.这是造成此问题的原因之一.此外,我还需要包括用户名:password即使我的代理不需要安全身份验证,端口也要进行同样的操作.必须包含端口号,否则它将无法正常工作.第3步:将新更改保存在.Renviron文件中,然后重新启动RStudio.重新输入后,我在RStudio中检查了我的代理设置,> Sys.getenv("http_proxy")> Sys.getenv("https_proxy")最初几次,我意识到代理设置没有在RStudio中更改,因为我正在编辑错误的.Renviron文件.因此,最好在第2步中使用file.edit('〜/.Renviron')来确保它是正确的文件.所有这些之后,当我运行install.keras()时,它成功安装,包括安装Tensorflow.再次,最初我跳过了步骤1,所以开始安装keras,但是在安装tensorflow时失败了.仅通过所有步骤,我就能够通过代理成功安装keras和tensorflow.希望这会有所帮助.I've been trying to install and run keras in RStudio (Windows) in vain.i installed keras package using normal package "keras"(didn't use github)I've installed latest python (3.6) and Anaconda.then i use> library(keras)> install.keras()and i get this error:I've looked up everywhere on the web and can't figure out how to install keras and tensorflow properly. Using latest version of R (3.4.2)Every method fails somewhere.just to add to misery, i've also tried:> devtools::install_github("rstudio/keras") and i get this error:I am not behind any authenticated proxies. So, after multiple failure, i just downloaded the zip file from github and manually installed it using the zip file.i also tried install.packages("keras") and that didn't give me any error either.when i call the library i don't get any errors (as shown above)UPDATE: I was able to install and use the package very easily on another computer that doesn't have python/anaconda installed on it already. UPDATE 2: my proxy does not need authentication and there is no https_proxy either. 解决方案 OK,, FINALLY found a solution.Turns out RStudio uses a lot of default proxy settings, so i needed to change all that and set up my own proxy settings.First step: Rstudio --> Tools --> Global Options --> packages --> uncheck both "Use secure download method for HTTP" and "Use Internet Explorer librayr/proxy for HTTP"Second step, in RStudio type:> file.edit('~/.Renviron')Either an empty file or some file with already existing proxy settings will open. (Mine was empty). Then I included the following two:(a few notes: I didn't have a https_proxy setting but I still needed to use the http_proxy details for my https_proxy setting. This was one of the culprits for my issue. Also, I needed to include the username:password even though my proxy doesn't need secure authentication. Same thing goes with the port. Port number had to be included, otherwise it wouldn't work.Step 3:Saved the new changes in .Renviron file and restarted RStudio.I checked my proxy settings in RStudio after restart by typing:> Sys.getenv("http_proxy")> Sys.getenv("https_proxy")The first few times i did this i realised that the proxy settings were not being changed in RStudio because i was editing the wrong .Renviron file. So, it's best to use file.edit('~/.Renviron') in step 2 to make sure it's the right file.After all this, when i ran install.keras(), it installed successfully, including installing Tensorflow. Again, initially i had skipped step 1 so keras started being installed but it failed at installing tensorflow.It was only going through all the steps that i was able to install both keras and tensorflow successfully over a proxy. Hope this helps. 这篇关于RStudio中的install.keras()失败,出现HTTP连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-30 04:03