pyenv-autoenv
is a pyenv plugin that
will automatically create and upgrade your project's virtualenv.
Install using git:
$ git clone https://github.com/strokirk/pyenv-autoenv.git $(pyenv root)/plugins/pyenv-autoenv
Upgrade by removing and reinstalling, or with git:
$ git --git-dir $(pyenv root)/plugins/pyenv-autoenv/.git pull
To create the virtualenv of a project, simply run pyenv autoenv
and let
the magic happen.
It will create a virtualenv named after the current directory using the latest available Python version.
To specify a specific Python version, use the --python
flag.
$ pyenv autoenv --python 3.X.Y
To customize the name of the created virtualenv, use the --name
flag.
$ pyenv autoenv --name venv-name
To recreate the virtualenv even if one already exists, use the --clear
flag.
$ pyenv autoenv --clear
If you only want to recreate the virtualenv when you're using an older
version than the recommended one for the proejct, use the --clear-if-lower
flag.
$ pyenv autoenv --clear-if-lower