gpt4 book ai didi

python - Pyenv 无法在 mac 中安装 python 3.5.2

转载 作者:行者123 更新时间:2023-12-03 17:22:59 28 4
gpt4 key购买 nike

我正在尝试在 macOS Big Sur(11.1) 上安装 python3.5.2
3.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我的 .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)

关于python - Pyenv 无法在 mac 中安装 python 3.5.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65419853/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com