Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

@myamada

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

$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
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
0
Help us understand the problem. What are the problem?