1

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

Leo
  • 33
  • 5
  • Are you *sure* the first part is being evaluated at shell startup? e.g. that the `pyenv` function has been created, and you're not just running the `pyenv` executable from the path? When you run `type pyenv`, does it show you a path, or the definition of a pyenv function? – Paul Roub May 05 '20 at 19:57
  • Yes, `type pyenv` returns `pyenv is a shell function`. And - if I masked the relevant part in _.profile_ pyenv'd not be called in terminal. – Leo May 05 '20 at 20:04
  • Followup: right - at login `type pyenv` returns a path down in the home dir, where the executable is. But if I masked the relevant part in _.profile_ pyenv'd not be called at all in terminal. – Leo May 05 '20 at 20:11

1 Answers1

0

Try pyenv init --path instead of pyenv init - and again putting it in bashrc.