[Python]macOS Mojave上のpyenvで2.7.15がインストールできない
普通にインストールしようとしたら、以下のようになる。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | $ pyenv install 2.7.15 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-2.7.15.tar.xz... -> https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz Installing Python-2.7.15... python-build: use readline from homebrew BUILD FAILED (OS X 10.14.3 using python-build 1.0.10-405-g61034680) Inspect or clean up the working tree at /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213024.61651 Results logged to /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213024.61651.log Last 10 log lines: checking for --with-icc... no checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213024.61651/Python-2.7.15': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details make: *** No targets specified and no makefile found. Stop. |
普通は以下のようにcommand line toolsをインストールすれば(もしくはcommand line toolsを最新に更新すれば)直るっぽいんだけど、今回は直らなかった。
1 2 3 4 5 6 7 8 9 10 11 12 13 | # command line toolsをインストール $ xcode-select --install # もしくはcommand line toolsをアップデート $ softwareupdate -l # 最新のcommand line toolsを調べる Software Update Tool Finding available software Software Update found the following new or updated software: * Command Line Tools (macOS Mojave version 10.14) for Xcode-10.2 # これがアップデートすべきもの Command Line Tools (macOS Mojave version 10.14) for Xcode (10.2), 199076K [recommended] $ softwareupdate -i "Command Line Tools (macOS Mojave version 10.14) for Xcode-10.2" # アップデート |
あるサイトには色々CFLAGとか追加したら直るみたいな記事があったので試してみたけど、ダメだった。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | $ CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \ LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \ PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \ pyenv install -v 2.7.15 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945 ~/.pyenv Downloading Python-2.7.15.tar.xz... -> https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz ^[[C/var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945/Python-2.7.15 /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945 ~/.pyenv Installing Python-2.7.15... python-build: use readline from homebrew ~(中略)~ checking size of uintptr_t... configure: error: in `/var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945/Python-2.7.15': configure: error: cannot compute sizeof (uintptr_t) See `config.log' for more details make: *** No targets specified and no makefile found. Stop. BUILD FAILED (OS X 10.14.3 using python-build 1.0.10-405-g61034680) Inspect or clean up the working tree at /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945 Results logged to /var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945.log Last 10 log lines: checking size of long long... 0 checking for long double support... yes checking size of long double... 0 checking for _Bool support... yes checking size of _Bool... 0 checking for uintptr_t... yes checking size of uintptr_t... configure: error: in `/var/folders/2f/936bl12n26n3jhgrqwdmbyvc0000gp/T/python-build.20190426213041.62945/Python-2.7.15': configure: error: cannot compute sizeof (uintptr_t) See `config.log' for more details make: *** No targets specified and no makefile found. Stop. |
それからうだうだとサイトを探していると、以下のコマンドを走らせろとの記述があった。
1 | $ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
xcode-selectの最新バージョン(2354)にMojave用のmacOS SDK headerがデフォルトで入っていないのが原因のようです。
言われた通りやってみると、今度は直って正常にインストールすることができた。
この記事へのコメントはこちら