Pyenv won't install python 3 on Mac os 11
Solution 1
I ran into the same issue today and managed to get one step further after diving into the config.log
and checking this post here.
I had to take the opposite direction and execute sudo xcode-select --switch /Applications/Xcode.app/
after downloading Xcode from the App Store. If you run clang --version
it should show Apple clang version 12.0.0 (clang-1200.0.32.27)
.
I was able to execute pyenv install 3.9.0
and get past the C compiler cannot create executables
error, but unfortunately it still failed. config.log
is huge this time around, will see if I can find anything.
EDIT: I managed to install 3.8.0 by executing the following command including a patch found here.
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
There have been some macOS 11.0 merges, but I assume the repos used for the pyenv install
command are simply not yet updated. This workaround will suffice for my needs for now, however.
Solution 2
I've successfully installed python 3.6.13 on the m1 macbook with this command.
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.13 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
jasonm
Updated on June 06, 2022Comments
-
jasonm almost 2 years
Trying to install Python 3.9.0 on Mac OS 11.0.1 with
pyenv install 3.9.0
.Results:
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.0.1 using python-build 20180424) Inspect or clean up the working tree at /var/folders/n6/q2b78971589bltfczw539flh0000gn/T/python-build.20201114175722.7103 Results logged to /var/folders/n6/q2b78971589bltfczw539flh0000gn/T/python-build.20201114175722.7103.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/n6/q2b78971589bltfczw539flh0000gn/T/python-build.20201114175722.7103/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.
Many suggestions in similar questions seem to revolve around XCode, but
xcode-select --install
says command line tools already installed.Any help appreciated.