网状未设置 python 路径

Reticulate not setting python path

我正在尝试在 R 中使用网状结构。

在 bash 我得到:

which python
# ~/.pyenv/shims/python

但是当我在 R 中设置它时,我从来没有让它工作。谁能帮我理解为什么?

library(reticulate)
my_python='~/.pyenv/shims/python'
use_python(my_python, required = T)  # throws no message
py_config() #throws error below
#Error in initialize_python(required_module, use_environment) : 
# Python shared library not found, Python bindings not loaded.

请注意,我确保 ~/pyenv/shims/$PATH 中。

非常感谢您的提前帮助

我遇到了同样的问题,经过大量搜索后我偶然发现了这个问题。希望它会有所帮助:https://github.com/rstudio/reticulate/issues/291#issuecomment-437143751

来自同一主题中的另一张海报: “您需要使用 Python 构建的版本,该版本由可动态加载的 库 (.dylib)。 R 不能 link 到静态 Python 库。"