Use pyenv's virtualenv capabilities.
This commit is contained in:
parent
c98da90662
commit
7e023cfc79
2 changed files with 43 additions and 2 deletions
|
@ -61,6 +61,25 @@ system site-packages directory.
|
|||
|
||||
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
|
||||
|
||||
If you have [pyenv-virtualenvwrapper][6] installed, it is going to be used
|
||||
instead.
|
||||
|
||||
pyenv-virtualenv
|
||||
----------------
|
||||
|
||||
[pyenv-virtualenv][5] is a new alternative to the virtualenvwrapper. It is a
|
||||
pyenv plugin that provides a `pyenv virtualenv` command to create virtualenvs
|
||||
for Python.
|
||||
|
||||
### Usage
|
||||
|
||||
Install pyenv-virtualenv.
|
||||
|
||||
Virtual environments are stored in *~/.pyenv/versions/*.
|
||||
|
||||
As pyenv-virtualenvwrapper doesn't seem to play nice with pyenv-virtualenv,
|
||||
then if it's installed, it's going to be used instead of pyenv-virtualenv.
|
||||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
|
@ -96,4 +115,6 @@ Authors
|
|||
[2]: http://www.doughellmann.com/projects/virtualenvwrapper/
|
||||
[3]: http://pypi.python.org/pypi/virtualenv
|
||||
[4]: https://github.com/yyuu/pyenv
|
||||
[5]: https://github.com/sorin-ionescu/prezto/issues
|
||||
[5]: https://github.com/yyuu/pyenv-virtualenv
|
||||
[6]: https://github.com/yyuu/pyenv-virtualenvwrapper
|
||||
[7]: https://github.com/sorin-ionescu/prezto/issues
|
||||
|
|
|
@ -34,8 +34,28 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Load pyenv's virtualenvwrapper into the shell session.
|
||||
if [[ $(pyenv commands) == *virtualenvwrapper* ]] 2&> /dev/null; then
|
||||
# Prefer pyenv over virtualenv.
|
||||
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
|
||||
|
||||
# Set the directory where virtual environments are stored.
|
||||
export WORKON_HOME="$HOME/.virtualenvs"
|
||||
|
||||
# Disable the virtualenv prompt.
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
|
||||
pyenv virtualenvwrapper
|
||||
|
||||
# Load pyenv's virtualenvs into the shell session.
|
||||
elif [[ $(pyenv commands) == *virtualenv-init* ]] 2&> /dev/null; then
|
||||
# Disable the virtualenv prompt.
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
|
||||
# Load virtualenvwrapper into the shell session.
|
||||
if (( $+commands[virtualenvwrapper.sh] )); then
|
||||
elif (( $+commands[virtualenvwrapper.sh] )); then
|
||||
# Set the directory where virtual environments are stored.
|
||||
export WORKON_HOME="$HOME/.virtualenvs"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue