LoginSignup
2
0

More than 5 years have passed since last update.

macOS10.14のpyenvで3.7.0がインストール出来ない場合の対処

Posted at
$pyenv install 3.7.0
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
python-build: use readline from homebrew

BUILD FAILED (OS X 10.14 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080
Results logged to /var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080.log

Last 10 log lines:
  File "/private/var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080/Python-3.7.0/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080/Python-3.7.0/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080/Python-3.7.0/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/15/rp2m1vg91glcqqh0hfd7pfd00000gn/T/python-build.20181025085539.41080/Python-3.7.0/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

と表示されてインストールが止まってしまった。

% xcode-select --install

これを忘れているのではという記事をよく見ますが、それも出来ているのに上手くいかない人は、以下の設定を行ってからインストールをしてみてください。

export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"

参考記事 https://github.com/pyenv/pyenv/issues/993

どうもライブラリのパスが上手く取っていないようです。
自分のエラーの場合は、brew周りは問題無く見えていてzlib周りだけでしたので、参考記事のzlib部分の設定だけ組み込んでみたところ、上手くいきました。

その後再度インストールを行うと以下の様に通った。

$pyenv install 3.7.0
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
python-build: use readline from homebrew
Installed Python-3.7.0 to /Users/HOGEHOGE/.pyenv/versions/3.7.0
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0