pyenv: failed to activate virtualenv - settings not read from .profile at login

痞子三分冷 提交于 2020-05-17 07:03:47

问题


This is a known topic, almost similar to this one.

However - why am I having the pyenv settings passed in ok from .profile at login only up to the virtualenv string.

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi
  eval "$(pyenv virtualenv-init -)"

After login, the above portion is read (pyenv is active in terminal) but not virtualenv. Manual activation of the venv produces the well-known error message.

$pyenv activate venv_name

Failed to activate virtualenv.

Perhaps pyenv-virtualenv has not been loaded into your shell properly.
Please restart current shell and try again.

I can solve this by explicitly sourcing .profile - then it works fine. But why would .profile not be read or interpreted at once at login?

Modifying .bashrc takes no effect. Seems like it's not being read. But .profile is. Global python is system (2.7).

Take care

来源:https://stackoverflow.com/questions/61621499/pyenv-failed-to-activate-virtualenv-settings-not-read-from-profile-at-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!