Mac上使用pyenv安装python报错

本文讲述了在Mac上使用pyenv安装Python3.11.6时遇到的错误,涉及到检查配置、gcc问题和命令行工具安装。解决方案包括重新安装Xcode和清理相关文件。

问题

在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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值