警告:`pyenv init -` 不再设置 PATH.苹果系统 [英] WARNING: `pyenv init -` no longer sets PATH. MacOS

查看:40
本文介绍了警告:`pyenv init -` 不再设置 PATH.苹果系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于错误的原因,我通过运行 pyenv update 更新了 pyenv,此后每次打开新控制台时都会出现此错误

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.

我尝试将其添加到我的 .zshrc 中:

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.

更多信息:

系统:MacOS Catalina 10.15.7pyenv 2.0.2 版

System: MacOS Catalina 10.15.7 Pyenv version 2.0.2

谢谢各位

推荐答案

看来您需要按照原始错误消息中建议的步骤操作

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- 在 .zprofile 中(在我的情况下,我没有一个,我必须在用户根路径中创建它)我添加了这个:

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- 在 .zshrc 中我添加了:

2- In .zshrc I added:

eval "$(pyenv init -)"

仅此而已

顺便说一下你的错误:

Failed to initialize virtualenvwrapper.

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

与该问题没有直接关系,如果修复对您不起作用,也许发布您的 .zshrc .bashprofile 片段可以帮助您更好地了解问题

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

我希望这对你有用.

这篇关于警告:`pyenv init -` 不再设置 PATH.苹果系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆