tests/testthat/resources/venv-activate.R

args <- commandArgs(TRUE)
venv <- args[[1]]

Sys.unsetenv("RETICULATE_PYTHON")
Sys.unsetenv("RETICULATE_PYTHON_ENV")

reticulate::use_virtualenv(venv, required = TRUE)
sys <- reticulate::import("sys")
writeLines(sys$path)
rstudio/reticulate documentation built on Oct. 29, 2024, 8:07 a.m.