$ pyenv install 3.7.4
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.4.tar.xz…
-> https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
Installing Python-3.7.4…
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 10.14.6 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/fs/yp3b5ks53mvbrgjjfm3s5q7w0000gp/T/python-build.20190915065206.97525
Results logged to /var/folders/fs/yp3b5ks53mvbrgjjfm3s5q7w0000gp/T/python-build.20190915065206.97525.log
“__Py_InitializeFromConfig”, referenced from:
_test_init_from_config in _testembed.o
_test_init_dev_mode in _testembed.o
_test_init_isolated in _testembed.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs….
make: *** [python.exe] Error 1
初回実行時のエラー内容。
試したこと
失敗例
brew install zlib
これは関係なかった
brew update
ひょっとしてupdateすれば自動的にうまくいくんでは説、はなかった
pip install pyexpat
binutilsをuninstallした後pyenv install 3.7.4をするとpyexpatがない、と出てきてこれを入れれば、と思ったがこれも無関係でした。
うまくインストールできたやり方
xcode-select –install
xcodeが入ってなければインストールします。
brew uninstall binutils
これが入ってるとうまく行かないらしいので一旦アンインストールしておきます。
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
必要なmacOS_SDK_headerをインストールするコマンド。後にCommandLineToolを入れるので必要かはわかりませんがとりあえずインストールしておいた。
pkgutil –pkg-info=com.apple.pkg.CLTools_Executables
CommandLineToolのバージョン情報を表示するコマンド。使用バージョンと合っているか、などのチェックに使います。
肝の部分
https://developer.apple.com/download/more/
ここからコマンドラインツールのバージョンが合っているものをダウンロードインストール、でpyenvでのpythonのインストールがうまくいきました。

Apple IDでのログインが必要になるので、つい飛ばして他の方法を探りたくなりますがこのコマンドラインツールをインストールするのが正解のようです。
各バージョンの調べ方
Xcodeのバージョン

Xcodeを起動してAbout Xcodeを開くとVersion情報が出てきます。10.3でした。
Macのバージョン

りんごマークから「このMacについて」を開くとバージョンが出てきます。10.14.6でした。
この二つのバージョンと合っているコマンドラインツールをインストールします。

macOSのバージョンは10.14.6だったので10.14、Xcodeのバージョンは10.3だったのでこれをダウンロードインストール。
$ pyenv install 3.7.4
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.4.tar.xz…
-> https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
Installing Python-3.7.4…
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.7.4 to /Users/toru/.pyenv/versions/3.7.4
これでpythonのpyenvが動作するようになりました。