pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

Deactivating Pyenv virtual enviornment

Open sbhakat opened this issue 6 years ago • 0 comments

Quite similar to this issue https://github.com/pyenv/pyenv-virtualenv/issues/32 however I posted the question at the above mentioned link but got no reply.

I have the following problem while deactivating pyenv

#Checking the version

pyenv versions
  system
  3.6.7
  3.6.7/envs/keras-test
* keras-test (set by /home/sbhakat/.python-version)

Then I progressed like

env | grep PYENV
PYENV_ROOT=/home/sbhakat/.pyenv
PYENV_VIRTUALENV_INIT=1
PYENV_VIRTUAL_ENV=/home/sbhakat/.pyenv/versions/3.6.7/envs/keras-test
PYENV_SHELL=bash

Trying to deactivate like

pyenv sh-deactivate keras-test
unset PYENV_VIRTUAL_ENV;
unset VIRTUAL_ENV;
if [ -n "${_OLD_VIRTUAL_PATH}" ]; then
  export PATH="${_OLD_VIRTUAL_PATH}";
  unset _OLD_VIRTUAL_PATH;
fi;
if [ -n "${_OLD_VIRTUAL_PYTHONHOME}" ]; then
  export PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME}";
  unset _OLD_VIRTUAL_PYTHONHOME;
fi;
if [ -n "${_OLD_VIRTUAL_PS1}" ]; then
  export PS1="${_OLD_VIRTUAL_PS1}";
  unset _OLD_VIRTUAL_PS1;
fi;
if declare -f deactivate 1>/dev/null 2>&1; then
  unset -f deactivate;
fi;

I also hashed the following part in .bashrc however seems like it is not working any help?

#if command -v pyenv 1>/dev/null 2>&1; then
#   eval "$(pyenv init -)"
#fi

This seems like an annoying problem. any help?

sbhakat avatar Nov 17 '18 10:11 sbhakat