. Advertisement .
..3..
. Advertisement .
..4..
If you are trying to run your Python installation via pyenv in a Ubuntu machine, you might have encountered this error: “WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration“. Here are some tips on how to solve this error.
When Does The Error “WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration” Occur?
You may encounter a new message when upgrading pyenv by using the pyenv activate command to access one of your created virtual environments and then beginning a terminal session. WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration.
How To Solve The Error “WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration”?
Approach 1: Simply change
A straightforward Python version management tool is pyenv. pyenv, formerly known as Pythonbrew, allows you to alter the default Python version, install additional Python versions, specify Python versions for specific directories or projects, and, yes, construct and manage virtual Python environments (also known as “virtualenvs”). Without relying on Python itself, all of this is accomplished on *NIX-style computers (Linux and OS X) and operates at the user-level without the usage of sudo commands.
After researching, we found that the easiest way to resolve your error is simply changing eval “$(pyenv init -)” from your ~/.bashrc to eval “$(pyenv init –path)” in your ~/.bashrc file. Let’s look at the following example to have more knowledge about this method:
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
Although this is a simple metthod, it works perfectly. After you do that, your error will be completely resolved and your program will run well without any errors. So, what are you waiting without applying this method for your error? Let’s do it to get your desired results.
Approach 2: Remove or comment these lines from ~/.bashrc
Another solution to fix the error “WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration” is removing or commenting these lines from ~/.bashrc
export PATH="/home/yogi/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Include the following lines before sourcing ~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
After that, the Source profile. source ~/.profile
Conclusion
We hope you enjoy our blog post on how to repair the error “WARNING: `pyenv init -` no longer sets PATH. Run `pyenv init` to see the necessary changes to make to your configuration”. Please leave a comment if you have any further questions or concerns regarding this problem. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!
Read more
→ How Can You Resolve The Error: The Python path in your debug configuration is invalid
Leave a comment