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)

Try the reticulate package in your browser

Any scripts or data that you put into this service are public.

reticulate documentation built on Sept. 11, 2024, 8:31 p.m.