【问题标题】:Cannot see Python function documentation in R with reticulate在 R 中看不到带有网状结构的 Python 函数文档
【发布时间】:2021-06-22 14:47:35
【问题描述】:

我在 RStudio (1.4) 上遇到了一个问题,我在帮助面板中看不到 Python 文档。我正在使用reticulate v. 1.20,我的 Python 解释器工作正常。但如果我使用 F1 键盘快捷键或运行例如 ?np.random.rand 我会收到以下错误:

>>> ?np.random.rand
Error in html$page(pydoc$describe(resolved), html$document(resolved, name)) : 
  attempt to apply non-function
Error in html$page(pydoc$describe(resolved), html$document(resolved, name)) : 
  attempt to apply non-function
Error in html$page(pydoc$describe(resolved), html$document(resolved, name)) : 
  attempt to apply non-function

帮助面板显示:/python/np.random.rand.html not found

在其他地方没见过这个问题。

【问题讨论】:

    标签: python r documentation reticulate


    【解决方案1】:

    这似乎在reticulate的开发版中修复了,可以如下安装:

    devtools::install_github("rstudio/reticulate")

    【讨论】:

      【解决方案2】:

      reticulate 是否存在该功能?有一个请求帮助的内置功能:py_help - https://rdrr.io/github/rstudio/reticulate/man/py_help.html 例如以下为我启动了一个帮助文件

      library(reticulate)
      os <- import("os")
      py_help(os$listdir)
      

      【讨论】:

      • reticulate 的文档描述了使用 F1 显示帮助 rstudio.github.io/reticulate/articles/rstudio_ide.html
      • 啊我的错误我只发现了?np.random.rand 部分抱歉。如果没有人可以在这里帮助您,您可能会在他们的 Github 页面上进一步发布此内容
      • 谢谢,有一个问题解决了这个github.com/rstudio/reticulate/issues/1011。通过安装开发版本修复它:devtools::install_github("rstudio/reticulate")
      • 听起来应该将此评论作为答案发布@WillHipson?我刚刚遇到了同样的问题,开发版(1.20)也为我解决了这个问题。
      猜你喜欢
      • 2020-05-30
      • 1970-01-01
      • 1970-01-01
      • 2019-06-01
      • 2021-02-01
      • 2017-10-19
      • 2018-08-08
      • 2021-05-19
      • 1970-01-01
      相关资源
      最近更新 更多