Mac M1 pyenv 3.12.4 설치 오류
created Sep 18, 2024 | updated Sep 18, 2024
Mac M1 pyenv 3.12.4 설치하는데 cannot stat 'Modules/_blake2.cpython-312-darwin.so': No such file or directory
오류가 발생했다.
오류 내용
❯ pyenv install 3.12.4
...
Installing Python-3.12.4...
python-build: use readline from homebrew
python-build: use ncurses from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 14.4.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/v8/ntfqm0zn0m917b3z_b5g91_00000gp/T/python-build.20240918140235.92604
Results logged to /var/folders/v8/ntfqm0zn0m917b3z_b5g91_00000gp/T/python-build.20240918140235.92604.log
Last 10 log lines:
/opt/homebrew/bin/ginstall -c -m 755 Modules/zlib.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/zlib.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_dbm.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_dbm.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/readline.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/readline.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_md5.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_md5.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_sha1.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_sha1.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_sha2.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_sha2.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_sha3.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_sha3.cpython-312-darwin.so
/opt/homebrew/bin/ginstall -c -m 755 Modules/_blake2.cpython-312-darwin.so /Users/lou/.pyenv/versions/3.12.4/lib/python3.12/lib-dynload/_blake2.cpython-312-darwin.so
ginstall: cannot stat 'Modules/_blake2.cpython-312-darwin.so': No such file or directory
make: *** [sharedinstall] Error 1
...
해결
# libb2 설치 후 3.12.4 설치
brew install libb2
pyenv install 3.12.4
기타 : ChatGPT 4o의 가이드
ChatGPT 4o는 다음과 같이 가이드했다.
1. 종속성 설치
brew update
brew install openssl readline xz zlib bzip2
2. pyenv 빌드 시 환경 변수 설정
CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
PYTHON_CONFIGURE_OPTS="--enable-shared"
3. Xcode Command Line Tools 재설치
xcode-select --install
4. zlib 및 기타 라이브러리 관련 문제 해결
export PATH="$(brew --prefix)/opt/zlib/bin:$PATH"
export LDFLAGS="-L$(brew --prefix)/opt/zlib/lib"
export CPPFLAGS="-I$(brew --prefix)/opt/zlib/include"