1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mac+pyenvでconfigure: error: C compiler cannot create executablesが起こったときの対処法

Posted at

起こった現象

Mac(Big Sur)でpyenv installを行おうとすると、下記エラーが発生しました
色々調べたところ、どうやらOSをアップデートしたことが原因のようです

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

Inspect or clean up the working tree at /var/folders/6j/sngymjzn5975q6dzn83231080000gn/T/python-build.20210923150353.1269
Results logged to /var/folders/6j/sngymjzn5975q6dzn83231080000gn/T/python-build.20210923150353.1269.log

Last 10 log lines:
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... clang
checking whether the C compiler works... no
configure: error: in `/var/folders/6j/sngymjzn5975q6dzn83231080000gn/T/python-build.20210923150353.1269/Python-3.7.8':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

対処法

以下2つの対応を行って解消しました

xcodeの再インストール

コンパイルがうまくいかないのは、主にxcodeが原因のようです。
荒業ですが、以下の手順で行いました

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

venvの再インストール

念の為venvも再インストールしました

rm -rf /Users/【ユーザー名】/.pyenv/
brew uninstall pyenv
brew install pyenv

私の環境では以上の対応で解決しました!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?