title: pyenv configure: error: C compiler cannot create executables
body: <p>I am trying to install multiple versions of Python on my laptop running MacOS Big Sur v11.1. I initially installed xcode command line tools, homebrew, and python via instructions <a href="https://docs.python-guide.org/starting/install3/osx/" rel="noreferrer">here</a></p>
  <p><code>xcode-select --install</code></p>
  <p><code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;</code></p>
  <p><code>brew install python</code></p>
  <p>But later on involuntarily upgraded python to 3.9, and I need to go back to 3.7.9. So I installed pyenv and attempted to install python 3.7.9 per instructions <a href="https://opensource.com/article/19/5/python-3-default-mac" rel="noreferrer">here</a></p>
  <p><code>brew install pyenv</code></p>
  <p><code>pyenv install 3.7.9</code></p>
  <p>But I encountered the following error:</p>
  <pre><code>/var/folders/8n/ml0qwc091w9bhpszzxy9djl00000gn/T/python-build.20210118111111.56108 /usr/local/Cellar
  /var/folders/8n/ml0qwc091w9bhpszzxy9djl00000gn/T/python-build.20210118111111.56108/Python-3.7.9 /var/folders/8n/ml0qwc091w9bhpszzxy9djl00000gn/T/python-build.20210118111111.56108 /usr/local/Cellar
  checking build system type... x86_64-apple-darwin20.2.0
  checking host system type... x86_64-apple-darwin20.2.0
  checking for python3.7... no
  checking for python3... python3
  checking for --enable-universalsdk... no
  checking for --with-universal-archs... no
  checking MACHDEP... checking for --without-gcc... no
  checking for --with-icc... no
  checking for gcc... clang
  checking whether the C compiler works... no
  configure: error: in `/var/folders/8n/ml0qwc091w9bhpszzxy9djl00000gn/T/python-build.20210118111111.56108/Python-3.7.9':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  make: *** No targets specified and no makefile found.  Stop.
  </code></pre>
  <p>From other answers online it seems my gcc may be out of date. I checked my gcc version with</p>
  <pre><code>[/usr/local/Cellar]$ gcc --version
  Configured with: --prefix=/Library/Developer/CommandLineTools/usr
      --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin20.2.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  </code></pre>
  <p>Which seems to indicate I am on version 4.2.1. I have not been able to find a way to update it on my own yet, but did <code>brew install gcc</code> which did not resolve the problem. Any help would be much appreciated</p>
  <p><strong>EDIT:</strong>
  Seems pyenv is using clang and not gcc. Perhaps xcode-select installed both? <code>clang --version</code> returns:</p>
  <pre><code>Apple clang version 11.0.3 (clang-1103.0.32.62)
  Target: x86_64-apple-darwin20.2.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  </code></pre>