【问题标题】:Source_python not working when called from within app.R从 app.R 中调用 Source_python 时不起作用
【发布时间】:2020-07-27 23:56:05
【问题描述】:

我有一个需要 python 代码的闪亮应用程序。当我从 RStudio 调用 Source_python 时,它工作正常,但是当我运行闪亮的应用程序(从 app.R 中获取 python 文件)时,python 代码不可用。

我正在使用安装了所有依赖项的虚拟 python 环境。我从 RStudio 以及闪亮的应用程序中调用了 py_config(),并且输出是相同的。

知道为什么这仍然不起作用吗?

【问题讨论】:

    标签: r shiny reticulate


    【解决方案1】:

    我将 source_python 调用移动到 R 脚本中,并在 app.R 中获取该 R 脚本。

    app.R:
    图书馆(闪亮)
    图书馆(网状)
    来源("FUNS.R")

    FUNS.R:
    reticulate::source_python("ABC.py")

    现在应用程序在 RStudio Server 上运行良好,并且在部署到远程 Shiny Server 时也可以正常运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-11
      • 2014-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多