title: How install and use different versions of pythons on MacOS using pyenv
body: <p>Starting out when I run <code>$ which python3</code> I get:</p>
  <pre><code>/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
  </code></pre>
  <p>And in my .zprofile I have:</p>
  <pre><code>PATH=&quot;/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}&quot;
  export PATH
  </code></pre>
  <p>So starting out, I have 3.8 installed and it works. Now, I need to create a setup that will allow me to install and use different versions of python for different projects.</p>
  <p>So, I tried the following:</p>
  <pre><code>$ brew update
  $ brew install pyenv
  $ pyenv version
  </code></pre>
  <p>It printed out <code>System</code>. So, it only sees the python 2.7 that comes with macos. Then I tried:</p>
  <pre><code>$ pyenv install 3.9.1
  $ pyenv install 3.8.7
  $ echo -e 'if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then\n  eval &quot;$(pyenv init -)&quot;\nfi' &gt;&gt; ~/.zshrc
  $ source ~/.zshrc
  </code></pre>
  <p>Now, at the end of my <code>.zshrc</code> file I have:</p>
  <pre><code>if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then
    eval &quot;$(pyenv init -)&quot;
  fi
  </code></pre>
  <p>But I still just get <code>System</code> when I run <code>$ pyenv version</code>. I know the different python versions are getting installed in <code>~/.pyenv/versions</code> directory. So, what else am I supposed to do to get it
  to list all the versions and switch back and forth between them?</p>