问题
在Mac上使用pyenv安装python时出错:
Installing Python-3.11.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 13.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/92/rlh_l4wd4r513j02hvnpjjrw0000gn/T/python-build.20231222095820.4952
Results logged to /var/folders/92/rlh_l4wd4r513j02hvnpjjrw0000gn/T/python-build.20231222095820.4952.log
Last 10 log lines:
checking pkg-config is at least version 0.9.0... yes
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/92/rlh_l4wd4r513j02hvnpjjrw0000gn/T/python-build.20231222095820.4952/Python-3.11.6':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
解决方案
重新安装xcode
rm -rf /Library/Developer/Command Line Tools
xcode-select --install