WARNING: `pyenv init -` no longer sets PATH. MacOS
Asked Answered
W

1

4

For the wrong reason I updated my pyenv, by running pyenv update, after this every time when I open a new console I got this error

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

I have tried with adding this into my .zshrc:

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

That was recommended in other posts and questions but in that case, I got another error message:

Failed to initialize virtualenvwrapper.

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

further info:

System: MacOS Catalina 10.15.7 Pyenv version 2.0.2

Thanks guys

Workable answered 6/7, 2021 at 22:51 Comment(0)
B
5

Looks like you need to follow the suggested steps in the original error message

run `pyenv init` to see the necessary changes to make to your configuration.

I had the same message and all that I had to do was:

1- In .zprofile (in my case i didn't have one and I had to create it, in user root path) I added this:

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

2- In .zshrc I added:

eval "$(pyenv init -)"

and that was all

by the way your error:

Failed to initialize virtualenvwrapper.

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

is not directly related to that issue, maybe posting the fragment of yout .zshrc .bashprofile can help to understand better the problem if the fix does not work for you

I hope this works for you.

Ballinger answered 6/7, 2021 at 22:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.