pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

Use venv when available instead of virtualenv

Open tyrion opened this issue 6 years ago • 4 comments

From what I can understand, currently virtualenv is used by default even if venv is present.

The README states:

pyenv-virtualenv uses python -m venv if it is available and the virtualenv command is not available.

Also from the code it seems that venv is not used if virtualenv is present.

Reading a previous issue ( https://github.com/pyenv/pyenv-virtualenv/issues/294 ), I assumed that venv was the preferred choice, but that doesn't seem to be the case anymore.

If you don't intend to use venv by default can you at least provide a flag to use it?

I would strongly suggest to use venv by default. With virtualenv I ended up with a 7 years old version of site.py.

Thank you for pyenv-virtualenv :)

tyrion avatar May 22 '19 10:05 tyrion

Makes sense. Please consider creating a PR then.

blueyed avatar Jun 09 '19 09:06 blueyed

Any news on that ?

cscetbon avatar Feb 14 '20 21:02 cscetbon

@cscetbon likely not.

FWIW I (still) recommend to just not use pyenv-virtualenv, but other methods. I prefer having an autocd-handler that activates a venv based on a .venv in its (parent) directory (https://github.com/Tarrasch/zsh-autoenv#automatically-activate-python-virtualenvs) And creating a venv is as easy as python -m venv .venv, where you can use ~/.pyenv/versions/…/bin/python then if you need a specific version.

blueyed avatar Feb 14 '20 22:02 blueyed

I think pyenv-virtualenv is so convenient that I'll keep that warning around 🤷‍♂️

cscetbon avatar Feb 14 '20 22:02 cscetbon