Mark
Mark

Reputation: 5108

Switch python versions using pyenv

Im trying to switch to python 2.715. I do:

pyenv versions

I see:

  system
* 2.7.15 (set by /Users/me/.pyenv/version)
  3.7.2
  3.7.2/envs/env_name
  3.8.0
  env_name

I then do:

python --version

Yet I get the result:

Python 3.9.7

How can I switch to python 2.7.15?

Upvotes: 2

Views: 676

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191894

You need to add the shim to your system PATH

Edit your .bashrc or .zshrc, and add

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

Worth pointing out that Python2 is EOL, and you really shouldn't be using it.

Upvotes: 2

Related Questions