2
2

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 3 years have passed since last update.

pyenv installしたときのZipImportError

Last updated at Posted at 2021-02-20

環境

  • MacOSX 11.2.1 BigSur

エラー内容

MacOSXでのzlibエラー。
pyenv install 3.8.5を叩くとエラーがでた。

$ pyenv install 3.8.5
error
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.5...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

ログのtailはこんな感じ。

log
    __import__(pkg_name)
  File "<frozen zipimport>", line 241, in load_module
  File "<frozen zipimport>", line 709, in _get_module_code
  File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

対処法

Tipsによく転がっているxcode-selectや、pkgのインストールなどではうまくいかなかったが、下記でうまくいった。

LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib" pyenv install 3.8.5

参考にした記事

こちらの記事に書いてあった。
https://github.com/pyenv/pyenv/issues/1219#issuecomment-727951276

2
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?