It would be nice to have workflow support for the pyenv-plugin, maybe as a wrapper? A tool would be cool too... With the plugin installed currently, this can be somewhat achieved by simply hacking out the locations and using pyenv as is.
env.PYENV_VERSION = "2.7.11"
env.PYENV_ROOT = "${env.HOME}/.pyenv"
env.PATH = "${env.PYENV_ROOT}/shims:${env.PYENV_ROOT}/bin:${env.PATH}"
sh "pyenv install -s ${env.PYENV_VERSION}; eval \"\$(pyenv init -)\"; pyenv shell ${env.PYENV_VERSION}"
There is a problem with this though. pyenv can run into concurrency issues while re-hashing. The plugin actually seems to have support for handling this with a file lock, but it would be a bit complicated to "redo" that functionality in a pipeline. I imagine it would be more beneficial just to expose this as a wrapper or installable version tools.
Some references to the current semaphore locking system:
https://github.com/yyuu/pyenv/issues/174#issuecomment-58499673
https://github.com/jenkinsci/pyenv-plugin/blob/master/lib/pyenv.rb#L24
See Deprecating non-Java plugins.