但是,当使用R-Studio运行相同的代码(和相同的模块)时,它可以正常工作而不会出现错误。 可能要检查/比较的设置/配置是什么?
需要使脚本每天自动运行几次。我确实使用R-studio开发了一个可行的解决方案。然后尝试从命令行R.exe .....运行相同的脚本->产生错误。 (OS WIN Server 2016标准)
> library(reticulate)
Warning message:
package ‘reticulate’ was built under R version 3.5.3
> py_run_string("import zlib, sys, struct, numpy")
Error in sys$stdout$flush() : attempt to apply non-function
> py_run_string("i = 5")
Error in sys$stdout$flush() : attempt to apply non-function
> py$i
[1] 5
> library(reticulate)
Warning messages:
package ‘reticulate’ was built under R version 3.5.3
> py_run_string("import zlib, sys, struct, numpy")
> py_run_string("i = 5")
> py$i
[1] 5
尝试使用
查找差异py_discover_config() no luck they are the same.
(python) sys.getdefaultencoding no luck they are the same.
(R) Sys.getlocale() no luck they are the same.
即使代码似乎也可以执行-如何清除这些代码: “ sys $ stdout $ flush()中的错误:尝试应用非功能”