Sunday, May 28, 2017

differences between "pyenv", "pyenv-virtualenv" and "virtualenv"

differences between "pyenv", "pyenv-virtualenv" and "virtualenv" are very confusing. clearly defined the definition on this article.

1. pyenv

"pyenv" globally manage python versions. each versions has one environment.
% pyenv versions
  system
  2.7.5
  2.7.6
  2.7.8
* 3.5.0

2. virtualenv

"pyenv-virtualenv" is external function of pyenv. multiple environments can exist on same versions.
~/virtualenv1 % bash bin/activate  # activate peen-virtualenv
(virtualenv1) ~/virtualenv1 % pyenv versions
  system
  2.7.5
  2.7.6
  2.7.8
* 3.5.0 (set by xxx/.python-version)
(virtualenv1) ~/virtualenv1 % deactivate  # deactivate peen-virtualenv
~/virtualenv1 %

3. pyenv-virtualenv

"virtualenv" apply python versions to each directories. virtualenv automatically change environment when user move on the directories.
~/pyenv_test $ cd pyenv-virtualenv1/
(pyenv-virtualenv1) ~/pyenv_test/pyenv-virtualenv1 $

(pyenv-virtualenv1) ~/pyenv_test/pyenv-virtualenv1 $ cat .python-version
pyenv-virtualenv1