30
11

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でインストール時に「BUILD FAILED (OS X 10.15.7 using python-build 20180424)」が発生した場合の対処法

Posted at

概要

macのpyenvでpythonをインストールしようとした際に、以下のエラーが発生しました。
以下の手順で動くようになったので、対処法を記載します

エラー内容

$ pyenv install 3.5.6
 :
 :

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.5.6.tar.xz...
-> https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tar.xz
Installing Python-3.5.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

対処法

エラーメッセージに従い、zlibを追加して環境変数に追加することで解決しました

  • brewでzlibをインストールする
$ brew install zlib
 :
 :
######################################################################## 100.0%
==> Pouring zlib-1.2.11.catalina.bottle.tar.gz
==> Caveats
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find zlib you may need to set:
  export LDFLAGS="-L/usr/local/opt/zlib/lib"
  export CPPFLAGS="-I/usr/local/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/zlib/1.2.11: 12 files, 376.4KB
  • シェルの設定ファイルに加える
    ※zsh以外のシェルを使用している場合、対応する設定ファイルに追記して下さい
$ echo 'export LDFLAGS="-L/usr/local/opt/zlib/lib"' >> ~/.zshrc
$ echo 'export CPPFLAGS="-I/usr/local/opt/zlib/include"' >> ~/.zshrc
$ echo 'export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"' >> ~/.zshrc
  • ターミナルを再起動する
    ※ 下記のようにsourceコマンドで設定ファイルを再読み込みしても可能
$ source ~/.zshrc

参考サイト

30
11
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
30
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?