如何解决在 RStudio 中运行 python 函数 - 函数定义中的 eof 错误
我在 RStudio 中创建了以下 python 脚本
import numpy as np
def test_function(a,b):
print("We are in the function")
return (a+b)
test_function(7,4)
行 import numpy as np
运行良好。它在控制台 >>>
带有函数定义的行离开 ...
。好像还没有完全执行。
行 test_function(7,4)
生成
SyntaxError: unexpected EOF while parsing (<string>,line 1)
We are in the function
11
我遗漏了 EOF 的哪一部分?
另外,这个脚本似乎使用了网状安装:
reticulate::repl_python()
... AppData/Local/r-miniconda/envs/r-reticulate/python.exe.
我如何告诉它使用我的 conda 虚拟环境。在网状中,我会使用类似 reticulate::use_condaenv("env1")
的东西,但在这里怎么做?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。