0

I follow the installation instruction here, and installed pyenv under /home/mrcai/.pyenv.

When I log in as mrcai, pyenv works pretty well as expected; but when I switch to root and switch back as mrcai, zsh shows that it cannot find pyenv.

/home/mrcai/.zshrc:114: command not found: pyenv

And $PATH does not contain anything about .pyenv, which is not the case under normal situation.

It seems the configuration in .zshrc or .zprofile did not work well. So could anyone please teach me how to solve this error permanently? Thank you!

Here is my configuration:

  1. /home/mrcai/.zshrc
eval "$(pyenv init -)"
  1. /home/mrcai/.zprofile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
  • OS: WSL 2 (Ubuntu-20.04) (The same problem also occurs under CentOS 8.5.)
  • shell: zsh
mrcai
  • 1
  • 1
  • 1

1 Answers1

0

Donot install pyenv in this path. Do not install in the "/home" directory, this folder will be isolated when switched to root.

It is recommended to install the softwares in the "/usr/local" directory. It would be a good habit.