pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.37k stars 403 forks source link

Use venv when available instead of virtualenv #316

Open tyrion opened 5 years ago

tyrion commented 5 years ago

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 :)

blueyed commented 5 years ago

Makes sense. Please consider creating a PR then.

cscetbon commented 4 years ago

Any news on that ?

blueyed commented 4 years ago

@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.

cscetbon commented 4 years ago

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