1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyenv installでコケる(zlib)

Last updated at Posted at 2019-04-17

pyenvでpythonのバージョンを上げたい

$ pyenv install 3.x.x   // ここで止まる
$ pyenv global 3.x.x

エラー

$ pyenv install 3.x.x
python-build: use openssl from homebrew
python-build: use readline from homebrew

<...>

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

Inspect or clean up the working tree at /var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862
Results logged to /var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862.log

Last 10 log lines:
  File "/private/var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862/Python-3.5.1/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/private/var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862/Python-3.5.1/Lib/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862/Python-3.5.1/Lib/ensurepip/__init__.py", line 116, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/82/wbj2z1dx1px5tgqszjg3fdt80000gn/T/python-build.20190417125321.77862/Python-3.5.1/Lib/ensurepip/__init__.py", line 40, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available   👈 zlibを入れればええんか?
make: *** [install] Error 1

これで解決しました

$ brew install zlib
$ brew install sqlite
$ export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"
$ export LDFLAGS="${LDFLAGS} -L/usr/local/opt/sqlite/lib"
$ export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/sqlite/include"
$ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"
$ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/sqlite/lib/pkgconfig"
$ pyenv install 3.6.8

参考: https://github.com/jiansoung/issues-list/issues/13#issuecomment-470275744

他に試したこと

$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

-> 同様にfailed

$ brew install zlib

-> zlibだけ入れても意味がなかった

1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?