Skip to content

How to create a virtualenv and activate it immediately in a script

Ryan Boehning edited this page Nov 18, 2020 · 2 revisions
# PROBLEM
pyenv virtualenv 3.9.0 foo-3.9.0
poetry install # won't install packages to the new virtualenv!
# SOLUTION
pyenv virtualenv 3.9.0 foo-3.9.0
export VIRTUAL_ENV="$(pyenv virtualenv-prefix)/envs/foo-3.9.0"
poetry install # installs packages to the new virtualenv
Clone this wiki locally