0

I'm trying to install pyenv and poetry on my Macbook Pro running Big Sur.

I followed all the instructions and help I could find online, but I'm stuck when trying to install a global Python version using pyenv install 3.9.0

This just produces the following output:

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

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

Inspect or clean up the working tree at /var/folders/_3/3n7g_jr918v2cj_pkdlfk5t40000gn/T/python-build.20210619130847.19436
Results logged to /var/folders/_3/3n7g_jr918v2cj_pkdlfk5t40000gn/T/python-build.20210619130847.19436.log

Last 10 log lines:
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/var/folders/_3/3n7g_jr918v2cj_pkdlfk5t40000gn/T/python-build.20210619130847.19436/Python-3.9.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

I created and added the following to a .zprofile file in my home folder - restarted shell even though it seems one does not need to do this on macosx...:


cat .zprofile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

The command line C compiler utils are installed for XCode.

Monty
  • 1,161
  • 2
  • 15
  • 26
  • Looks like you already have [Homebrew](https://brew.sh/), why don’t you install Python that way? Also, what’s the log file say? – Jens Jun 19 '21 at 12:55
  • 1
    "you already have Homebrew, why don’t you install Python that way?" Because Pyenv is part of the [recommended workflow for Poetry](https://python-poetry.org/docs/managing-environments/) (and Pipenv, too). Additionally, Brew doesn't let you specify the Python version more specifically than 3.9, 3.8 or 3.7. If you need 3.9.0 or 2.7.15, Brew can't help. Pyenv is just incredibly useful if you need different Python versions for different project. I highly recommend it. – Marlon Richert Jun 21 '21 at 07:37

0 Answers0