Search code examples
pythonpyenv

pyenv global 3.6.4rc1 not working


i'm using zsh. Here is my .zshenv

cat ~/.zshenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"

Here is my PATH:

echo $PATH
/Users/myuser/Downloads/google-cloud-sdk/bin:/Users/myuser/.pyenv/shims:/Users/myuser/.pyenv/bin:/Users/myuser/.rvm/gems/ruby-2.4.1/bin:/Users/myuser/.rvm/gems/ruby-2.4.1@global/bin:/Users/myuser/.rvm/rubies/ruby-2.4.1/bin:/Users/myuser/Downloads/google-cloud-sdk/bin:/Users/myuser/.nvm/versions/node/v8.4.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myuser/.pyenv/bin:/Users/myuser/.rvm/bin

Now trying to change python version to 3.6.4rc1 it says on 2.7 see below:

➜  ~ pyenv versions
  system
* 3.6.4rc1 (set by /Users/myuser/.pyenv/version)
➜  ~ pyenv global 3.6.4rc1
➜  ~ python --version
Python 2.7.10 # Why doesn't it change to 3.6.4rc1?

However I need to source .zshenv and then it works:

➜  ~ source ~/.zshenv
➜  ~ pyenv global 3.6.4rc1
➜  ~ python --version
Python 3.6.4rc1

What should I do so that the command `it works properly. (note i'm on mac).


Solution

  • aha! RESOLVED added /source Users/myuser/.zshenv to ~/.zshrc and now it's working. apparently .zshenv is not loaded on new zsh terminal.. I wonder if that's the standard with zsh or something problematic on my machine.