use_config() 没有改变我在 R 网状结构中的 python 配置

use_config() is not changing my python configuration in R reticulate

我是 R 中的 reticulate 包的新手,我遇到了问题。我正在使用 use_python 指定我想使用的 python 版本 (anaconda3 - python3.7) 但它不起作用。

这是我的代码:

    library(reticulate)

    sys <- import("sys")

    sys$version
    [1] "2.7.10 (default, Oct  6 2017, 22:29:07) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]"

    use_python("/anaconda3/bin/python3", required = TRUE)

    sys$version
    [1] "2.7.10 (default, Oct  6 2017, 22:29:07) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]"

在终端中,我输入了命令 which python 并显示: /anaconda3/bin/python

此外,当我检查 py_config() in R console 时,我得到: py_config

但是当我在 R 控制台中使用 py_discover_config() 时,我得到: py_discover_config

由于无法加载我的 anaconda3 的任何模块,我如何在网状结构中使用此 python3.7 版本?

已解决。

对于遇到同样问题的人。

library(reticulate)
use_python("pathToPython", required = TRUE)

那你可以试试

py_config()

并且应该可以正常工作。这只是命令的顺序。