homebrew – Upgraded pyenv by brew, now only system python activated on new terminal

Yesterday I upgraded pyenv via brew from -> 2.0.3. Since that time now when I open any new terminal window, python is linked to the built in system Python 2 instead of my global pyenv python.

If I do a pyenv virtualenvwrapper in a terminal window, and then create and activate a virtual environment (mkvirtualenv foobar and workon foobar) then my global pyenv Python is activated correctly. Ex:

$ pyenv global

$ which python

$ python

WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Mar 25 2021, 03:11:28)
(GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.

$ pyenv virtualenvwrapper

$ mkvirtualenv foobar

created virtual environment CPython3.9.6.final.0-64 in 346ms
  creator CPython3Posix(dest=/Users/adam.parkin/.envs/foobar, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/adam.parkin/Library/Application Support/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
virtualenvwrapper.user_scripts creating /Users/adam.parkin/.envs/foobar/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/adam.parkin/.envs/foobar/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/adam.parkin/.envs/foobar/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/adam.parkin/.envs/foobar/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/adam.parkin/.envs/foobar/bin/get_env_details

$ workon foobar

$ python
Python 3.9.6 (default, Jul 19 2021, 19:04:48)
(Clang 12.0.0 (clang-1200.0.32.29)) on darwin
Type "help", "copyright", "credits" or "license" for more information.

But I don’t understand why a new fresh terminal isn’t using the Pyenv python instead of the system default python?

My path seems to be pointing to the shims directory before /usr/bin, yet a which python is pointing to /usr/bin/python. My path:

$ echo $PATH

As you can see I have the pyenv-virtualenv plugin installed.

The output from the brew upgrade pyenv command when I upgraded can be found in this gist: https://gist.github.com/pzelnip/ca99bf955fe15f66225a41f597501dff

My .bashrc contains the following lines related to pyenv (these are the last 3 lines of my bashrc):

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

If I do a PYENV_DEBUG=1 pyenv init -, the output can be seen in this gist: https://gist.github.com/pzelnip/641a862c19f35571c20fb7d2cb1aabe8