[英]Pyenv can't install python 3.5.2 in mac
我正在嘗試在 macOS Big Sur(11.1) 上安裝 python3.5.2
python-build: use openssl from homebrew
python-build: use readline from homebrew
Installing Python-3.5.2...
patching file Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
patching file configure
Hunk #1 succeeded at 3439 (offset 13 lines).
patching file configure.ac
Hunk #1 succeeded at 490 (offset -20 lines).
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/2d/jw08s7rx35d25b3lj52kr68r0000gn/T/python-build.20201223151024.74644
Results logged to /var/folders/2d/jw08s7rx35d25b3lj52kr68r0000gn/T/python-build.20201223151024.74644.log
Last 10 log lines:
Python/random.c:97:19: note: did you mean 'py_getentropy'?
Python/random.c:89:1: note: 'py_getentropy' declared here
py_getentropy(unsigned char *buffer, Py_ssize_t size, int fatal)
^
Python/random.c:106:19: error: implicit declaration of function 'getentropy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
res = getentropy(buffer, len);
^
2 errors generated.
make: *** [Python/random.o] Error 1
make: *** Waiting for unfinished jobs....
我試過了,重新安裝pyenv
, readline
, make
, camke
, xz
, bzip2
, zlib
我寫了.zshrc
...
# pyenv settings
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# The usual `pyenv init` stuff
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
if [[ "$(uname -s)" == "Darwin" ]] ; then
# Adopted SDK workaround from @marcosgomesborges
[[ -n "$MACOSX_DEPLOYMENT_TARGET" ]] || export MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -c -5)" # e.g.: 10.14
[[ -n "$SDKROOT" ]] || export SDKROOT="$(xcrun --show-sdk-path)"
# Workaround for OpenSSL header/library paths (for GCC & LINKER)
pfx_openssl="$(brew --prefix openssl)" # Change this if openssl was not installed via homebrew
if [[ -d "$pfx_openssl" ]] ; then
export CPATH="${pfx_openssl}/include:${CPATH}" # Headers for C pre-processor
export LIBRARY_PATH="${pfx_openssl}/lib:${LIBRARY_PATH}" # libraries (for the linker)
fi
fi
# zlib && bzip2 settings
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
...
LDFLAGS="-L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.5.10 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
提供 CFLAGS -
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.