diff --git a/modules/python/README.md b/modules/python/README.md index c48f4ea3..bd904d6a 100644 --- a/modules/python/README.md +++ b/modules/python/README.md @@ -16,6 +16,16 @@ execution of `pythonz`. Install Python versions with `pythonz install` into *~/.pythonz/pythons*. +pyenv +----- + +An alternative pythonz is to use [pyenv][6], which allows for switching between +multiple, isolated Python installations in the home directory. + +### Usage + +Install Python versions with `pyenv install` into *~/.pyenv/versions*. + Local Package Installation -------------------------- @@ -107,4 +117,4 @@ Authors [3]: http://pypi.python.org/pypi/virtualenv [4]: http://saghul.github.com/pythonz/ [5]: https://github.com/sorin-ionescu/prezto/issues - +[6]: https://github.com/yyuu/pyenv diff --git a/modules/python/init.zsh b/modules/python/init.zsh index a72f01f9..6b5b4f1c 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -9,10 +9,20 @@ # Load pythonz into the shell session. if [[ -s $HOME/.pythonz/bin/pythonz ]]; then path=($HOME/.pythonz/bin $path) + +# Load manually installed pyenv into the shell session. +elif [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then + path=("$HOME/.pyenv/bin" $path) + eval "$(pyenv init -)" + +# Load package manager installed pyenv into the shell session. +elif (( $+commands[pyenv] )); then + eval "$(pyenv init -)" + fi # Return if requirements are not found. -if (( ! $+commands[python] && ! $+commands[pythonz] )); then +if (( ! $+commands[python] && ! ( $+commands[pythonz] || $+commands[pyenv] ) )); then return 1 fi