在 Anaconda Windows 安装下出现问题 运行

Problems running reticulate under Anaconda Windows install

我在使用 R Studio 中的网状库做最基本的事情时遇到了麻烦。我的代码如下所示:

library(reticulate)
use_python("C:\Users\User2017\AppData\Local\Programs\Python\Python36\python.exe")
 req <- import("requests")

最后一行出现错误

parse error: trailing garbage
          2017\Documents\.condarc" } Using Anaconda Cloud api site h
                     (right here) ------^

我怎样才能让它工作?使用 requests 只是例如,其他所有包都会失败。 python 我将网状包指向的是系统范围 python,已经安装了各种包。

我的规格来自 运行 sessionInfo() :

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C                       LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reticulate_1.11.1

loaded via a namespace (and not attached):
[1] compiler_3.5.3  Matrix_1.2-15   tools_3.5.3     yaml_2.2.0      Rcpp_1.0.1      grid_3.5.3      jsonlite_1.6   
[8] lattice_0.20-38

我这边同样的问题:

pandas <- import("pandas") 
Error: parse error: trailing garbage
      Documents\.condarc" } Using Anaconda Cloud api site h
                 (right here) ------^

我遵循了 smci 的建议:从我的计算机中删除 Anaconda 并重新链接到另一个 python 安装后,问题消失了:

use_python("~/Python36/python")
os <- import("os")

希望对您有所帮助!

添加:Python 2.7.11,Anaconda2 4.0.0 64 位