Pyenv-virtualenv: How to manage existing virtual-envs?

Created on 31 Jan 2020  路  1Comment  路  Source: pyenv/pyenv-virtualenv

Hi
I already have several virtual-envs created with python -m venv ....
Now I've installed _pyenv_ and i'm looking for a way to introduce my virtual-envs to _pyenv_. Is there any way? or I have to re-create them and reinstall all packages?

Most helpful comment

From what I can tell this isn't possible, however it would be great if you could specify a path where a virtual environment should be created/activated/deleted from. This will allow users switching from the builtin venv (the de facto standard at this point) module to use their existing environments and mental models for how venvs work. Further, in my opinion at least, I find it easier to remember that venvs live inside the project directory rather than remembering an arbitrary naming scheme - in some sense the path to a project directory is ready-to-use and unique namespace for virtual environments.

One could imagine a non-intrusive implementation of this feature where specifying a virtual environment name beginning with a . or / would be treated as a path to where a venv should be installed or activated from. For example, one could imagine a .python-version file with the following contents:

./venv

>All comments

From what I can tell this isn't possible, however it would be great if you could specify a path where a virtual environment should be created/activated/deleted from. This will allow users switching from the builtin venv (the de facto standard at this point) module to use their existing environments and mental models for how venvs work. Further, in my opinion at least, I find it easier to remember that venvs live inside the project directory rather than remembering an arbitrary naming scheme - in some sense the path to a project directory is ready-to-use and unique namespace for virtual environments.

One could imagine a non-intrusive implementation of this feature where specifying a virtual environment name beginning with a . or / would be treated as a path to where a venv should be installed or activated from. For example, one could imagine a .python-version file with the following contents:

./venv
Was this page helpful?
0 / 5 - 0 ratings