C编译器无法创建可执行文件

时间:2021-03-18 21:21:28

标签: macos gcc cc

我正在尝试安装弹性 beanstalk cli,如下所示:

./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer

但我收到以下错误:

python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
python-build: use readline from homebrew

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

Inspect or clean up the working tree at /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557
Results logged to /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557.log

Last 10 log lines:
checking for python3.7... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557/Python-3.7.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
   Exiting due to failure

出于某种原因,安装脚本没有检测到 C 编译器。当然,gcc 和 cc 命令都可以在终端中使用。我使用的是 macOS 11.1。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

需要使用Rosetta来运行命令,通过Rosetta可以使用arch命令来运行命令:

arch -x86_64 ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer