Pyenv can't install python 3.5.2 in mac
Asked Answered
D

2

6

I'm trying to install python3.5.2 on macOS Big Sur(11.1)

3.5.2 Install Logs

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....

I've tried, Reinstalling pyenv, readline, make, camke, xz, bzip2, zlib And I wrote .zshrc

My .zshrc File

...
# 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"
...
Davis answered 23/12, 2020 at 6:17 Comment(3)
Same here on catalinaOutlander
Same on Big SurAppaloosa
Same for MontereyBrewmaster
S
3
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)
Sutler answered 23/6, 2021 at 17:41 Comment(0)
S
0

Provide CFLAGS -

$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
Suctorial answered 20/1, 2021 at 1:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.