Python
openssl
brew
pyenv
HighSierra

pyenvをHigh Sierraで操作(+openssl update)

High Sierraにして下記エラーに出くわしたら

$pyenv install 3.6.3
Downloading Python-3.6.1.tar.xz...
-> https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
Installing Python-3.6.1...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.13.1 using python-build 20160602)

対処法は、上記エラー内のリンクか、https://github.com/pyenv/pyenv/issues/993 を参照

$CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.6.3

opensslのversion up

上記でダメなら、opensslのversionが古い可能性がある。
ex, MBP 2016モデルのOSXのデフォルトは0.9.8で古い

# 事前確認
$openssl version
OpenSSL 0.9.8zh 14 Jan 2016
$which openssl
/usr/bin/openssl
$echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/bin
# アップデート
$brew install openssl
$brew list openssl
/usr/local/Cellar/openssl/1.0.2n/.bottle/etc/ (8 files)
/usr/local/Cellar/openssl/1.0.2n/bin/c_rehash
/usr/local/Cellar/openssl/1.0.2n/bin/openssl
/usr/local/Cellar/openssl/1.0.2n/include/openssl/ (75 files)
/usr/local/Cellar/openssl/1.0.2n/lib/libcrypto.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2n/lib/libssl.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2n/lib/engines/ (12 files)
/usr/local/Cellar/openssl/1.0.2n/lib/pkgconfig/ (3 files)
/usr/local/Cellar/openssl/1.0.2n/lib/ (4 other files)
/usr/local/Cellar/openssl/1.0.2n/share/man/ (1680 files)
$ln -s /usr/local/Cellar/openssl/1.0.2n/bin/openssl /usr/local/bin/openssl
# コンソールを再起動または`$source ~/.bash_profile`を行い、更新を確認
$openssl version
OpenSSL 1.0.2n  7 Dec 2017

シンボリックリンクは$ln -s (brew --prefix openssl)/bin/openssl /usr/local/bin/opensslでもいいと思う。