Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues installing Python 3.8.10 on macOS 12.3 Monterey

Anyone having issues installing python 3.8.10 on macOS Monterey M1 Mac? Any version I try to install using pyenv install gives me this error:

python-build: use [email protected] from homebrew python-build: use readline from homebrew Downloading Python-3.8.10.tar.xz... -> https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tar.xz Installing Python-3.8.10... python-build: use readline from homebrew python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129 Results logged to /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129.log

Last 10 log lines: checking for --with-cxx-main=<compiler>... no checking for clang++... no configure:

By default, distutils will build C++ extension modules with "clang++". If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin configure: error: internal configure error for the platform triplet, please file a bug report make: *** No targets specified and no makefile found.  Stop.

I've tried almost all questions across Google Search without success =(. I've tried to install using asdf python plugin and pyenv.

like image 432
honikun Avatar asked Aug 31 '25 10:08

honikun


2 Answers

Apple introduced a change that resulted in its breaking.

In your specific case pyenv install 3.8.13 should work.

For others on different versions should check this thread

Or use any of these versions 3.7.13, 3.8.13, 3.9.11 and 3.10.3

like image 96
rahulg Avatar answered Sep 02 '25 22:09

rahulg


This worked for me.

Install gcc first;

brew install gcc

And then with gcc run pyenv installation.

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.10

enter image description here

like image 41
Isanka Wijerathne Avatar answered Sep 02 '25 23:09

Isanka Wijerathne