Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.
$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
myamada
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした