I created a virtual env using this method within my VSCode Studio.
pyenv install 3.7.4
pyenv virtualenv 3.7.4 apps3
pyenv local apps3
pyenv activate apps3
However, when I check python --version
after the last command, it still shows me Python 2.7.16
, which is my default shell version.
However, if I try to activate the env in another terminal (outside VSCode), I am able to see the correct version. How can I fix it within VSCode?
Within VSCode, I see these:
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 terminal (outside VS):
/usr/local/Caskroom/miniconda/base/bin/python