I summarized it because it was difficult to find out how to deal with the error that occurred when building the python environment on mac.
I entered the following command in the terminal when installing python.
$ pyenv install 3.9.1
Then, the following error appeared.
Last 10 log lines:
checking for python3.9... python3.9
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/9y/b18s20496nz6mc47pmf2czdm0000gn/T/python-build.20210117143950.2739/Python-3.9.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
It was solved by installing gcc (Command Line Tools of Xcode).
Open Xcode and open the upper left (next to the apple mark) Xcode tab> Open Developer Tools> More Developer Tools ...
Log in with your Xcode apple ID
Download Command Line Tools for Xcode 12.0.dmg (any version)
Installation
Confirmation of installation
gcc -dumpversion
12.0.0
After performing the above operations, the error disappeared and python was installed.
pyenv install 3.9.1
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.1.tar.xz...
-> https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz
Installing Python-3.9.1...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.9.1 to /Users/shogo/.pyenv/versions/3.9.1
Recommended Posts