Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 警告:`pyenv init-`在启动终端窗口时不再设置路径_Python_Bash_Centos7_Pyenv - Fatal编程技术网

Python 警告:`pyenv init-`在启动终端窗口时不再设置路径

Python 警告:`pyenv init-`在启动终端窗口时不再设置路径,python,bash,centos7,pyenv,Python,Bash,Centos7,Pyenv,目标:我正试图在本文的帮助下在我的Linux机器上安装“pyenv”https://realpython.com/intro-to-pyenv/" 预期结果:根据文章pyenv应该添加到我的Linux机器的“加载路径” 实际结果:pyenv没有添加到加载路径,我必须手动添加到.bashrc文件 错误消息:实际上我现在没有看到任何错误消息。当我关闭终端窗口并打开新窗口时;每次我的终端窗口打开时,都会显示以下消息 WARNING: `pyenv init -` no longer sets PATH

目标:我正试图在本文的帮助下在我的Linux机器上安装“pyenv”https://realpython.com/intro-to-pyenv/"

预期结果:根据文章pyenv应该添加到我的Linux机器的“加载路径”

实际结果:pyenv没有添加到加载路径,我必须手动添加到
.bashrc
文件

错误消息:实际上我现在没有看到任何错误消息。当我关闭终端窗口并打开新窗口时;每次我的终端窗口打开时,都会显示以下消息

WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.
[centos@localhost ~]$ 
我所做的:我在SO中寻找答案,我发现我的问题有一些解决方案。但他们并没有像预期的那样为我工作。 我已将以下行添加到用户的
.bashrc
文件中

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
请注意,即使每次我向终端添加'pyenv'命令时都会出现此警告,但它会向我显示有效的结果

以下是我的
.bash\u档案
.bashrc
文件内容

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions

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

.bash\u配置文件

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

#JAVA_HOME=/data/programs/jdk1.8.0_221
#JAVA_HOME=/data/programs/jdk-13.0.2
#JAVA_HOME=/data/programs/jdk1.7.0_80
JAVA_HOME=/data/programs/jdk-11.0.8
#JAVA_HOME=/data/programs/jdk-14.0.1
M2_HOME=/data/programs/apache-maven-3.6.1
JRE_HOME=$JAVA_HOME


export PATH JAVA_HOME M2_HOME JRE_HOME
export PATH=$JAVA_HOME/bin:$M2_HOME/bin::$PATH

export PATH

下面是我的
.bashrc
文件内容

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
环境:Centos 7


我想在每次打开终端会话时删除此错误。如何解决此问题?

pyenv
已升级到2.0,并且init脚本已更改。从官方主页上阅读,但不要阅读第三方文章

检查

export PYENV_ROOT=“$HOME/.PYENV”
导出路径=“$PYENV_根/bin:$PATH”
eval“$(pyenv init--path)”