事象
M1チップで pyenv install を実行すると、高確率で以下エラーが発生し失敗する
BUILD FAILED (OS X 12.1 using python-build 20180424)
実行例
UNCO@HelloMyWorld ~ % pyenv install 3.8.5
Downloading openssl-1.1.1k.tar.gz...
-> https://www.openssl.org/source/openssl-1.1.1k.tar.gz
Installing openssl-1.1.1k...
Installed openssl-1.1.1k to /Users/UNCO/.pyenv/versions/3.8.5
Downloading readline-8.0.tar.gz...
-> https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz
Installing readline-8.0...
Installed readline-8.0 to /Users/UNCO/.pyenv/versions/3.8.5
Downloading Python-3.8.5.tar.xz...
-> https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
Installing Python-3.8.5...
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 12.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/ss/0f119lg97mxgzsjrt9z9l_3m0000gn/T/python-build.20220207225559.95873
Results logged to /var/folders/ss/0f119lg97mxgzsjrt9z9l_3m0000gn/T/python-build.20220207225559.95873.log
Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found. Stop.
回避策
私の場合、以下のコマンドでインストールが成功した
arch -arch x86_64 env PATH=${PATH/\/opt\/homebrew\/bin:/} pyenv install 3.8.5
実行例
UNCO@HelloMyWorld ~ % arch -arch x86_64 env PATH=${PATH/\/opt\/homebrew\/bin:/} pyenv install 3.8.5
Downloading openssl-1.1.1k.tar.gz...
-> https://www.openssl.org/source/openssl-1.1.1k.tar.gz
Installing openssl-1.1.1k...
Installed openssl-1.1.1k to /Users/UNCO/.pyenv/versions/3.8.5
Downloading readline-8.0.tar.gz...
-> https://ftpmirror.gnu.org/readline/readline-8.0.tar.gz
Installing readline-8.0...
Installed readline-8.0 to /Users/UNCO/.pyenv/versions/3.8.5
Downloading Python-3.8.5.tar.xz...
-> https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
Installing Python-3.8.5...
python-build: use zlib from xcode sdk
Installed Python-3.8.5 to /Users/UNCO/.pyenv/versions/3.8.5
-
Unable to build Python on macOS Big Sur with Xcode 12 beta · Issue #1643 · pyenv/pyenv · GitHub
github.com
-
M1版とIntel版のHomebrewを併用するときpyenvがうまく動かない問題を解決する #homebrew - Qiita
qiita.com