Skip to content
Home » WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration.

WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration.

To solve WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration. error follow below methods.

ERROR LOG

I recently upgraded pyenv, and using the pyenv activate command to activate one of my previously built virtual environments no longer sets the path to use what I’ve installed in that virtual environment. When I launch a terminal session, I notice a new message that says.

WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.

How to solve WARNING: `pyenv init -` no longer sets PATH ?

To solve WARNING: pyenv init no longer sets the PATH environment variable. Run pyenv init to see what modifications you need to make to your settings. If you have these lines in ~/.bashrc, delete/comment them and add these lines before sourcing ~/.bashrc. Then there’s the Source profile.

Now delete/comment these lines if you have in ~/.bashrc

export PATH="/home/yogi/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Then add these lines before sourcing ~/.bashrc

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

Alternative to Solve WARNING: `pyenv init -` no longer sets PATH

The similar warning appeared on a RH derivative Linux running bash 4.4.19. To fix that, I just updated the eval “$(pyenv init -)” in my ~/.bashrc to eval “$(pyenv init –path)” and the error went away. I don’t use ~/.profile for bash; one update to ~/.bashrc suffices for me:

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

Hope the above solution works.

Also read :

ImportError: cannot import name ‘PY3’ from ‘torch._six’
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED