Mac BigSur(macOS 11.0)에서 pyenv 로 python version 설치 오류

trycatch·2021년 5월 20일
0

문제

pyenv에서 파이썬 버전을 설치하는 경우 아래와 같은 오류가 발생 한다.

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

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

Inspect or clean up the working tree at /var/folders/s6/mh0mmnzj3d1_q8dnnrzz4zfh0000gn/T/python-build.20210520104919.80148
Results logged to /var/folders/s6/mh0mmnzj3d1_q8dnnrzz4zfh0000gn/T/python-build.20210520104919.80148.log

Last 10 log lines:
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
./Modules/posixmodule.c:10432:5: warning: code will never be executed [-Wunreachable-code]
    Py_FatalError("abort() called from Python code didn't abort!");
    ^~~~~~~~~~~~~
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes   -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/yh.kwon/.pyenv/versions/3.6.13/include -I/usr/local/opt/zlib/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/yh.kwon/.pyenv/versions/3.6.13/include -I/usr/local/opt/zlib/include  -DPy_BUILD_CORE  -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o
1 warning and 1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.

해결

brew를 이용하여 zlib, bzip2를 설치하고, 아래와 같은 명령어로 설치 하면 된다.

$ brew install zlib bzip2

아래와 같이 설치 하면 된다.

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.13 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)

0개의 댓글