'how to activate Pyenv locally

What's the correct way to activate a Pyenv environment? I want to use an env with python version 3.7.4. I tried this following this tutorial: https://akrabat.com/creating-virtual-environments-with-pyenv/

pyenv install 3.7.4
pyenv virtualenv 3.7.4 apps3
pyenv local apps3
pyenv activate apps3

However, when I check python --versionafter the last command, it still shows me Python 2.7.16, which is my default shell version.

In the tutorial there's also something about global vs local environments. What am I missing? Do I necessarily need to create a global env as well?

which python
/usr/bin/python

Path after activating:

/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/neehahammad/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Caskroom/miniconda/base/bin:/usr/local/Caskroom/miniconda/base/condabin:/Users/nh/.local/bin:/Users/nh/.local/bin

Path without environment activated:

/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/neehahammad/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Caskroom/miniconda/base/bin:/usr/local/Caskroom/miniconda/base/condabin:/Users/nh/.local/bin:/Users/nh/.local/bin

already added this in the .zschrc file

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

which python from another termainal (outside VS):

/usr/local/Caskroom/miniconda/base/bin/python


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source