我使用pyenv已经将近两年了,我的系统在X11模式下运行RHEL8.3(LinuxKern4.18)和Gnome3.32.2没有问题。我主要使用的是鱼壳,也偶尔也会使用bash,两者都与pyenv一起工作到现在为止。但是,在大约24小时前运行pyenv update
之后,使用pyenv activate
命令激活我创建的虚拟环境中的一个不再设置使用我在该虚拟环境中安装的内容的路径。
当我启动终端会话时,我看到一条新消息:
WARNING: `pyenv init -` no longer sets PATH.
Run `pyenv init` to see the necessary changes to make to your configuration.
所以我运行了pyenv init
,它告诉我:
# Add pyenv executable to PATH by adding
# the following to ~/.profile:
set -Ux PYENV_ROOT $HOME/.pyenv
set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
# Load pyenv automatically by appending
# the following to ~/.config/fish/config.fish:
pyenv init - | source
# and the following to ~/.profile:
pyenv init --path | source
# If your ~/.profile sources ~/.config/fish/config.fish,
# the lines should be inserted before the part
# that does that.
# Make sure to restart your entire logon session
# for changes to ~/.profile to take effect.
我很肯定我已经有了以上的一切。这是我的~/.profile
set -Ux PYENV_ROOT $HOME/.pyenv
set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
pyenv init --path | source
这是我的~/.config/fish/config.fish
# Set default editor
set -gx EDITOR nano
# Set Junest path
set PATH /home/[username]/.local/share/junest/bin $PATH
# Set pyenv root directory
set PYENV_ROOT $HOME/.pyenv
# Add pyenv and local bin to $PATH
set PATH $PYENV_ROOT/bin /home/[username]/.local/bin $PATH
# Add pyenv init to shell to enable shims and autocompletion
# Note the command `pyenv init` will tell you to add this line for fish
status --is-interactive; and source (pyenv init -|psub)
pyenv init - | source
我的~/.bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging featur$
# export SYSTEMD_PAGER=
# User specific aliases and functions
# Load pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
还有几点意见:
我发现,尽管我有environment.
set -Ux PYENV_ROOT $HOME/.pyenv
和~/.profile
或~/.config/fish/config.fish
中的set -Ux fish_user_paths $PYENV_ROOT/bin $fish_user_paths
并没有什么区别时,它就没有来源/运行。最后,即使激活了pyenv创建的虚拟环境,我仍然无法访问其中的内容。
我如何解决这个问题?谢谢。
发布于 2021-06-28 21:41:24
对于Mac和fish,将其添加到~/.config/fish/config.fish
中
set PYENV_ROOT $HOME/.pyenv
set -x PATH $PYENV_ROOT/shims $PATH
set -x PATH $PYENV_ROOT/bin $PATH
if command -v pyenv 1>/dev/null 2>&1
pyenv init - | source
end
https://stackoverflow.com/questions/67473902
复制相似问题