I want to dynamically create, destroy & use Python virtual environments that contain code loaded by pip
.
The virtualenvapi
Python package looks promising because it provides an install()
method that uses pip
to install packages. It supports both package name and URL arguments, both of which I need.
However, I would prefer to use venv
as I don't care about Python earlier than 3.6, virtual environments are complex, venv
is in the standard library but virtualenvapi
isn't, and there are good arguments to prefer venv
.
venv
provides API support with venv.EnvBuilder()
. But how does one accomplish this with it:
env = VirtualEnvironment('/path/to/environment/name')
env.install('git+https://github.com/KarrLab/log.git#egg=log')
Thanks