DEV Community

loading...

Discussion on: Install python 3.8.0 via pyenv on BigSur

Collapse
craiga profile image
Craig Anderson

For me, the problem was that I needed to have zlib (and possibly openssl@.1.1 and readline) installed from homebrew, and then having the following environment variable set.

export LDFLAGS="-L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/zlib/lib"
Enter fullscreen mode Exit fullscreen mode

I also had the following set, though I'm not sure if they're required.

export CPPFLAGS="-I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include"
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig"
Enter fullscreen mode Exit fullscreen mode

Hopefully this helps!

Collapse
codebrotha profile image
CodeBrotha

Thank you, this worked!

Collapse
eshack94 profile image
Elijah Shackelford • Edited

I'm having this same issue after re-installing pyenv (no issues prior to re-installing, but this is the first time I've needed to re-install after upgrading to Big Sur, so I think it's related). Trying your solution now.

Edit: Just reporting back — this worked for me. Thank you very much.

Others who come across this might also want to install and link bzip2 prior to compiling.

I.e.,

brew install bzip2
export LDFLAGS="-L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/bzip2/include"
Enter fullscreen mode Exit fullscreen mode
Thread Thread
jaclu profile image
Jacob Lundqvist • Edited

This is a snippet I use on all my machines, if you don't always use brew you could always wrap it in an outer check. And yes the -O2 might not be for everybody, then just skip it :)
This one will adhere to whatever location you might have used for Linux Homebrew, on Darwin you would always use /usr/local, since otherwise a lot of brew stuff fails, and it would be a pointless pain to workaround.

comment: Darwin doesn't set this variable, Linux HomeBrew does

if [ "$HOMEBREW_PREFIX" = "" ]; then
HOMEBREW_PREFIX="/usr/local"
fi

comment: Set the env to ensure brew can build stuff

export LDFLAGS="-L$HOMEBREW_PREFIX/opt/zlib/lib -L$HOMEBREW_PREFIX/opt/bzip2/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/zlib/include -I$HOMEBREW_PREFIX/opt/bzip2/include"
export CFLAGS="-O2"