pyenvで3.7.3のインストールができない
$ pyenv install 3.7.3 ~~ BUILD FAILED (OS X 10.14.5 using python-build 20180424) ~~ Last 10 log lines: File "/private/var/folders/fx/xtlqk0fj4hd0f8nnmznbzg680000gn/T/python-build.20190614132237.43257/Python-3.7.3/Lib/ensurepip/__main__.py", line 5, in <module> sys.exit(ensurepip._main()) File "/private/var/folders/fx/xtlqk0fj4hd0f8nnmznbzg680000gn/T/python-build.20190614132237.43257/Python-3.7.3/Lib/ensurepip/__init__.py", line 204, in _main default_pip=args.default_pip, File "/private/var/folders/fx/xtlqk0fj4hd0f8nnmznbzg680000gn/T/python-build.20190614132237.43257/Python-3.7.3/Lib/ensurepip/__init__.py", line 117, in _bootstrap return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) File "/private/var/folders/fx/xtlqk0fj4hd0f8nnmznbzg680000gn/T/python-build.20190614132237.43257/Python-3.7.3/Lib/ensurepip/__init__.py", line 27, in _run_pip import pip._internal zipimport.ZipImportError: can't decompress data; zlib not available make: *** [install] Error 1
zlib
が使えないと言われるが、brewでzlibとかは諸々入れている
公式のWikiには、additionalなSDK headerをインストールせよと書いてあるが、 Home · pyenv/pyenv Wiki · GitHub
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / installer: Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'.
と言われる。それはそうで、
$ ls /Library/Developer/CommandLineTools/
Library SDKs usr
Packages
など無い
解決法
SDK headerが無いので、includeする
fishなら
$ set -x CFLAGS -I(xcrun --show-sdk-path)/usr/include
bashとかなら
$ export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
をしてからpyenv install 3.7.3
をすれば良い