質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

3回答

2589閲覧

pyenvからpythonをアップデートするとエラーになる

fuku-chann

総合スコア82

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2022/12/02 08:52

編集2022/12/17 09:47

pyenvを使ってpythonを3.8.0にバージョンをアップデートしたいのですが、pyenv global 3.8.0を実行しても、3.8.0 not installedになってしまいます。pyenvのバージョンが古いのでアップデートしたいのですが、インストールした方法を忘れてしまい、アップデートの手順がわからない状況です。シェルはzshを使用しています。環境構築に関わる部分のため慎重に操作したいので、皆様のお力をお借りしております。

macOS Monterey 12.3.1
Python 3.6.0
pyenv 1.2.19-6-gbdfed51d
Visual Studio Code 1.45.1
Shell Zsh 5.8 (x86_64-apple-darwin21.0)

zsh

112/02/22 17:46 /Users/xxx pyenv global 3.8.0 2pyenv: version `3.8.0' not installed

zsh

112/02/22 18:39 /Users/xxx pyenv install 3.8.0 2python-build: use openssl@1.1 from homebrew 3python-build: use readline from homebrew 4Downloading Python-3.8.0.tar.xz... 5-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz 6Installing Python-3.8.0... 7python-build: use readline from homebrew 8python-build: use zlib from xcode sdk 9 10BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) 11 12Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221202184018.25600 13Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221202184018.25600.log 14 15Last 10 log lines: 16checking for python3... python3 17checking for --enable-universalsdk... no 18checking for --with-universal-archs... no 19checking MACHDEP... "darwin" 20checking for gcc... clang 21checking whether the C compiler works... no 22configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221202184018.25600/Python-3.8.0': 23configure: error: C compiler cannot create executables 24See `config.log' for more details 25make: *** No targets specified and no makefile found. Stop. 2612/02/22 18:40 /Users/xxx python -V 27Python 3.6.0

zsh

112/02/22 19:36 /Users/xxx/xxxx brew uninstall pyenv-virtualenv 2Error: No installed keg or cask with the name "pyenv-virtualenv" 312/02/22 19:37 /Users/xxx/xxxx brew uninstall pyenv 4Error: No installed keg or cask with the name "pyenv"

zsh

112/02/22 19:37 /Users/xxx/xxxx pyenv --version 2pyenv 1.2.19-6-gbdfed51d

zsh

112/02/22 19:38 /Users/xxx/xxxx brew -v 2Homebrew 2.5.4 3Homebrew/homebrew-core (git revision 9cbbe; last commit 2020-10-08) 4Homebrew/homebrew-cask (git revision f83515; last commit 2020-10-09)

zsh

112/02/22 21:00 /Users/xxx/xxxx which gcc 2/usr/bin/gcc

zsh

112/03/22 20:57 /Users/mxxx/.pyenv brew doctor 2Please note that these warnings are just used to help the Homebrew maintainers 3with debugging if you file an issue. If everything you use Homebrew for is 4working fine: please don't worry or file an issue; just ignore this. Thanks! 5 6Warning: "config" scripts exist outside your system or Homebrew directories. 7`./configure` scripts often look for *-config scripts to determine if 8software packages are installed, and which additional flags to use when 9compiling and linking. 10 11Having additional scripts in your path can confuse software installed via 12Homebrew if the config script overrides a system or Homebrew-provided 13script of the same name. We found the following "config" scripts: 14 /Users/mxxx/.pyenv/shims/python3.6m-config 15 /Users/mxxx/.pyenv/shims/python-config 16 /Users/mxxx/.pyenv/shims/python3-config 17 /Users/mxxx/.pyenv/shims/python3.6-config 18 19Warning: You are using macOS 12.3. 20We do not provide support for this pre-release version. 21You will encounter build failures with some formulae. 22Please create pull requests instead of asking for help on Homebrew's GitHub, 23Discourse, Twitter or IRC. You are responsible for resolving any issues you 24experience while you are running this pre-release version. 25 26Error: no implicit conversion of Array into Integer 27/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:36:in `first' 28/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:36:in `each' 29/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:36:in `max' 30/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:36:in `latest_sdk' 31/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:52:in `rescue in sdk_if_applicable' 32/usr/local/Homebrew/Library/Homebrew/os/mac/sdk.rb:45:in `sdk_if_applicable' 33/usr/local/Homebrew/Library/Homebrew/os/mac.rb:113:in `sdk' 34/usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb:408:in `check_if_supported_sdk_available' 35/usr/local/Homebrew/Library/Homebrew/cmd/doctor.rb:61:in `block in doctor' 36/usr/local/Homebrew/Library/Homebrew/cmd/doctor.rb:53:in `each' 37/usr/local/Homebrew/Library/Homebrew/cmd/doctor.rb:53:in `doctor' 38/usr/local/Homebrew/Library/Homebrew/brew.rb:119:in `<main>'

zsh

112/03/22 21:50 /Users/mxxx zsh --version 2zsh 5.8 (x86_64-apple-darwin21.0)

.zshrcにCC=/path/to/gcc pyenv install versionを追加。

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3export PYENV_ROOT="$HOME/.pyenv" 4export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 5eval "$(pyenv init -)" 6CC=/path/to/gcc pyenv install version

zsh

112/03/22 21:50 /Users/mxxx pyenv install 3.8.0 2python-build: use openssl@1.1 from homebrew 3python-build: use readline from homebrew 4Downloading Python-3.8.0.tar.xz... 5-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz 6Installing Python-3.8.0... 7python-build: use readline from homebrew 8python-build: use zlib from xcode sdk 9 10BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) 11 12Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203215920.3707 13Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203215920.3707.log 14 15Last 10 log lines: 16checking for python3... python3 17checking for --enable-universalsdk... no 18checking for --with-universal-archs... no 19checking MACHDEP... "darwin" 20checking for gcc... clang 21checking whether the C compiler works... no 22configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203215920.3707/Python-3.8.0': 23configure: error: C compiler cannot create executables 24See `config.log' for more details 25make: *** No targets specified and no makefile found. Stop.

CC=/path/to/gcc pyenv install versionの優先順位を上げてみましたが、依然としてCコンパイルエラーが出ています。

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3CC=/path/to/gcc pyenv install version 4export PYENV_ROOT="$HOME/.pyenv" 5export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 6eval "$(pyenv init -)"

zsh

112/03/22 22:01 /Users/mxxx pyenv install 3.8.0 2python-build: use openssl@1.1 from homebrew 3python-build: use readline from homebrew 4Downloading Python-3.8.0.tar.xz... 5-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz 6Installing Python-3.8.0... 7python-build: use readline from homebrew 8python-build: use zlib from xcode sdk 9 10BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) 11 12Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203220752.5154 13Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203220752.5154.log 14 15Last 10 log lines: 16checking for python3... python3 17checking for --enable-universalsdk... no 18checking for --with-universal-archs... no 19checking MACHDEP... "darwin" 20checking for gcc... clang 21checking whether the C compiler works... no 22configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221203220752.5154/Python-3.8.0': 23configure: error: C compiler cannot create executables 24See `config.log' for more details 25make: *** No targets specified and no makefile found. Stop.

zsh

112/04/22 7:18 /Users/mxxx/.pyenv gcc --version 2Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 3Apple clang version 11.0.0 (clang-1100.0.33.8) 4Target: x86_64-apple-darwin21.4.0 5Thread model: posix 6InstalledDir: /Library/Developer/CommandLineTools/usr/bin

zshecにCC=/Library/Developer/CommandLineTools/usr/binを追加しました。

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3export PYENV_ROOT="$HOME/.pyenv" 4export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 5eval "$(pyenv init -)" 6CC=/Library/Developer/CommandLineTools/usr/bin

まだCコンパイラエラーが治りません。

こういうことですかね?

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3export PYENV_ROOT="$HOME/.pyenv" 4export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 5eval "$(pyenv init -)" 6CC=/path/to/Library/Developer/CommandLineTools/usr/bin

上記でも同様のエラーが出たので、.zshrcのCC=/path/to/Library/Developer/CommandLineTools/usr/binの優先順位を上げました。

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3CC=/path/to/Library/Developer/CommandLineTools/usr/bin 4export PYENV_ROOT="$HOME/.pyenv" 5export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 6eval "$(pyenv init -)"

まだ同様のエラーが出るので違ったようですね。

元に戻しました。

zsh

1export PS1="%W %T %d %F{green}" 2#export PS1="%n %W %D{%T} %F{green}" 3CC=Library/Developer/CommandLineTools/usr/bin 4export PYENV_ROOT="$HOME/.pyenv" 5export PATH="$PYENV_ROOT/bin:/Users/mxxx/bin:$PATH" 6eval "$(pyenv init -)"

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

teamikl

2022/12/02 12:22

ビルドで失敗してるようなので、`which gcc` の実行結果を確認できますか? 同様のエラー報告では、3.8.13 をインストール、もしくは ビルドの際にコンパイラを指定(環境変数CCに設定)することで解決された事例があります。
fuku-chann

2022/12/02 18:35

コメントありがとうございます。結果を送付いたします。 12/02/22 21:00 /Users/xxx/xxxx which gcc /usr/bin/gcc
quickquip

2022/12/03 15:02 編集

CC=/path/to/gcc という書き方は「あなたの環境でのgccのありかをここに書け」という意味ですよ まさかそのまま打ったのではないですよね
teamikl

2022/12/03 17:17

補足ありがとう。 gcc のハスは環境により異なるので、コマンドラインツールのものを探してください。、 注意点: which gcc の結果のパスではありません。 これはデフォルトで使われた clang のものでビルドが失敗しています。 環境変数 CC の変更は、ビルドに使うコンパイラの変更する、という解決策の提案です。
fuku-chann

2022/12/04 00:15 編集

quickquip様、teamikl様ご回答ありがとうございます。 下記に/Library/Developer/CommandLineTools/usr/bin、とありますが、パスはこれではないでしょうか? zshrcに追加しましたが、Cコンパイラーエラーが治りませんでした。 12/04/22 9:11 /Users/mxxx gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin21.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
quickquip

2022/12/04 00:45

どうしてzshrcに入れようとしたんです?
fuku-chann

2022/12/04 00:49

teamikl様の下記の文章を読んで環境変数を設定ということでしたので、zshrcに入れましたが、理解が違っていましたでしょうか? 環境変数 CC にビルド時に指定したいコンパイラのパスを指定することもできます。 CC=/path/to/gcc pyenv install version という形で、一時的に環境変数を設定
quickquip

2022/12/04 01:02

なるほど、その箇所を読み違えていますね。 FOO=bar hogehoge と実行すると一時的にFOO環境変数にbarという値が設定された状態でコマンドhogehogeが実行されます。 だから > CC=/path/to/gcc pyenv install version という形で実行してみたらどうか、という話になってます。
fuku-chann

2022/12/04 01:11 編集

ありがとうございます。 下記実行しましたが、バージョンアップできませんでした。 まだ間違っていますでしょうか? (文字数の関係で質問文に結果を追記できなくなりましたので、少し読みづらいですが、こちらに追記させていただきます。) 12/04/22 9:13 /Users/mxxx CC=Library/Developer/CommandLineTools/usr/bin pyenv install 3.8.0 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.0.tar.xz... -> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz Installing Python-3.8.0... python-build: use readline from homebrew python-build: use zlib from xcode sdk BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204100615.21466 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204100615.21466.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... Library/Developer/CommandLineTools/usr/bin checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204100615.21466/Python-3.8.0': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/04/22 10:06 /Users/mxxx python -V Python 3.6.0
quickquip

2022/12/04 01:14

3.8.0はmacOS 11以降だとビルドできませんからね。
fuku-chann

2022/12/04 01:41 編集

ありがとうございます。 macOS12.3.1でビルドできるバージョンはいくつになりますでしょうか? Python 3.8.0の公式ページにfor OS X 10.9 and laterと記載されていましたので、10.9以降が対応しているように見えますがいかがでしょうか? https://www.python.org/downloads/release/python-380/ 取り急ぎ、下記の3つのバージョンを試しましたが、Cコンパイラーエラーがなくなりませんでした。 3.8.4 for OS X 10.9 and later 3.7.0 for OS X 10.9 and later 3.6.5 for OS X 10.9 and later 12/04/22 10:19 /Users/mxxx CC=Library/Developer/CommandLineTools/usr/bin pyenv install 3.6.5 python-build: use openssl from homebrew python-build: use readline from homebrew Downloading Python-3.6.5.tar.xz... -> https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz Installing Python-3.6.5... python-build: use readline from homebrew python-build: use zlib from xcode sdk BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204101919.24329 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204101919.24329.log Last 10 log lines: checking for --with-universal-archs... no checking MACHDEP... darwin checking for --without-gcc... no checking for --with-icc... no checking for gcc... Library/Developer/CommandLineTools/usr/bin checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204101919.24329/Python-3.6.5': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop.
quickquip

2022/12/04 01:56 編集

それはすでに回答が付いていますよね????????????????????? Big Sur以降でビルドできなくなる問題は、3.8.5で(私の回答) Apple Silicon CPUでビルド出なくなる問題は3.8.10で(私の回答) Monterey以降でビルドできなくなる問題は3.8.14で(teamiklさんの回答のリンク先URLに記載) 解決されています。 最新3.8.15にするべきと回答も書き直しましたよね????? (Monterey以降でビルドできなくなる問題を失念していたことに気づいたからなのですが)
quickquip

2022/12/04 01:51 編集

teamiklさんの回答は「Monterey以降でビルドできなくなる問題」への対処なので、他に3.8.10と3.8.5で入った対処(パッチ)を取り入れれば、無理矢理3.8.0のビルドも出来るかもしれませんが私の回答はあくまでも「最新3.8.15にするべき」です。
fuku-chann

2022/12/04 02:09 編集

ご説明ありがとうございます。 理解できていない部分が多く、ご迷惑をお掛けしてしまい申し訳ございません。 現在のpyenvには最新の3.8.15がないので、pyenvを最新にバージョンアップするのが先決、という理解でお間違い無いでしょうか?(現在のpyenvは3.8.4までしかlistに記載がありません) cpuはintelなので、3.8.5以降でも大丈夫ですが、いずれにしてもpyenvのバージョンアップが必要ということになりますでしょうか。
quickquip

2022/12/04 02:07

少なくとも私からの回答とコメントでは、今の.pyenv配下は捨てるべきと書いたつもりです。
fuku-chann

2022/12/04 02:14

承知いたしました。 下記のご回答になりますね。 早期解決のため、確認しながら進めさせていただきたいと思いますので、よろしくお願いいたします。 >.pyenvを削除して全部やり直した方がいい気がしますが。.zshrcや.zprofileからもpyenvの設定は削除して。 >何をどう作業したのかが失われていて、かつまっとうな手順ではなかったと見えるので。 .zshrcは3行目を削除でよろしいでしょうか? export PS1="%W %T %d %F{green}" #export PS1="%n %W %D{%T} %F{green}" export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:/Users/masa/bin:$PATH" eval "$(pyenv init -)" zprofileは下記の1行のみ記載がありましたが、このままで大丈夫でしょうか? export PATH=$HOME/.nodebrew/current/bin:$PATH
fuku-chann

2022/12/09 06:19 編集

ターミナルの内容から進捗状況を随時アップデートしていきたいと思います。 5日にgit pullが成功して、pyenvのバージョンリストが更新された。 6日にバージョンアップを全て完了した。 12/06/22 19:28 /Users/mxxx softwareupdate --list Software Update Tool Finding available software No new software available.
guest

回答3

0

macOSですよね。

https://www.python.org/downloads/release/python-3810/
CPUがApple Siliconなら3.8.10以降

https://github.com/python/cpython/pull/21113
Intel CPUでもmacOS 11以降だとこのパッチが入っている3.8.5 以降

にしましょう。

実際は、3.8系の最新3.8.15にするべきですでよいです


というかpyenvが古すぎるのでアップデートした方がいいです。
具体的な手順はどうやってpyenvをインストールしたかに依ります。


3.8.12はCC=(ここ省略)/gcc pyenv install 3.8.12しないとインストールできなかったけれど、パッチが3.8.13に入ったのでコンパイラにgccを指定する必要はないはず。
だからCommand Line Toolsがちゃんと入っていない or 使えていない問題に見える。


Command Line Toolsのバージョン確認方法

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

Command Line Toolsのインストールは昔の話だとxcode-select --installと書かれているものが多いけれど

sudo softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.4

の方がよさそう。


Command Line Toolsの再インストールは結局

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

と削除するほかなさそう。

投稿2022/12/02 09:58

編集2022/12/17 00:47
quickquip

総合スコア11029

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fuku-chann

2022/12/02 11:10

初期にやってから操作していないので覚えていません。。。 調べる方法はありますでしょうか?
fuku-chann

2022/12/02 11:31

.pyenvという名前のフォルダの作成日が下記の日付になっていました。 .pyenv作成日:2020年7月15日 水曜日 22:42 homebrewがインストールされており、last commitが2020年になっていました。 このPCを購入したのがそのくらいになりますので、環境構築で右往左往していたころです。 不確かな情報しかありませんが、他にも調べる方法があるようでしたらご教示ください。
quickquip

2022/12/02 12:18 編集

zshを使っている前提で unset -f pyenv which pyenv の結果をください。
fuku-chann

2022/12/02 12:01

結果を送付いたします。 12/02/22 20:59 /Users/xxx/xxxx unset -f pyenv unset: no such hash table element: pyenv 12/02/22 20:59 /Users/xxx/xxxx which pyenv /Users/xxx/.pyenv/bin/pyenv
quickquip

2022/12/02 12:19

pyenvがちゃんとインストールされてない可能性も少しでてきましたが…… とりあえず cd /Users/xxx/.pyenv git pull でいいんじゃないかと思います。
fuku-chann

2022/12/02 19:57

結果を送付いたします。 12/03/22 4:54 /Users/xxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out
quickquip

2022/12/02 23:03

ネットワーク環境は、その環境にいる人にしか調べられません。何を思ってこれを貼ったのかはわかりませんが、自分で調べていてただの経過報告なのだと信じたいところです。
quickquip

2022/12/02 23:04

Operation timed outになってるのだから操作自体は正しかったかな、と思います。
quickquip

2022/12/03 00:59 編集

的外れに見えます。 git remote -v でレポジトリの設定を見てみてください httpsになってませんか? (自分でpyenvをforkしてgit://でcloneしてたりするのでしょうか? それなら合ってますがその可能性は低いと感じます)
quickquip

2022/12/03 00:57

ネットワーク環境は普通のプロバイダーですか。何らかの制限がありうる会社のような環境ですか
fuku-chann

2022/12/03 02:29 編集

おっしゃる通りgit remote -vを実行すると、リンクがhttpsから始まっていましたので、的外れだったようです。 ネットワークは通常は普通のプロバイダーをwi-fiで使用しています。そのほかスマホテザリング2回線(iphoneとアンドロイド)でも試しましたが、同様のエラーになりました。 12/03/22 11:06 /Users/mxx/dxxx/axx-exx git remote -v origin https://github.com/fxx-cxx/axx-exx.git (fetch) origin https://github.com/fxx-cxx/axx-exx.git (push) 12/03/22 11:11 /users/mxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out 12/03/22 11:12 /users/mxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out 12/03/22 11:14 /users/mxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out 12/03/22 11:16 /users/mxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out 12/03/22 11:19 /users/mxx/.pyenv git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out
quickquip

2022/12/03 02:35 編集

レポジトリが明らかにおかしくてpyenvを指していませんね。ホームディレクトリに無関係なレポジトリができているような気がします。 .pyenvを削除して全部やり直した方がいい気がしますが。.zshrcや.zprofileからもpyenvの設定は削除して。 何をどう作業したのかが失われていて、かつまっとうな手順ではなかったと見えるので。
fuku-chann

2022/12/03 02:53

ありがとうございます。 他のご回答者様から問題点と確認事項をご教示いただいておりますので、実施してからご検討させていただきます。
quickquip

2022/12/04 05:24

> .zshrcは3行目を削除でよろしいでしょうか? 私なら export PATH="$PYENV_ROOT/bin:/Users/masa/bin:$PATH" の行を消して、.pyenvのファイルは全部消して、homebrewのpyenvを使うでしょう。 これで伝わっているのか、その環境でそんなことをしていいのかの判断は質問者さん以外できません。
fuku-chann

2022/12/04 06:11

ありがとうございます。 export PATH="$PYENV_ROOT/bin:/Users/masa/bin:$PATH"はコメントアウトして、pyenvはフォルダごとゴミ箱に移動しました。 この後は、brew install pyenvでインストールでしょうか? export PS1="%W %T %d %F{green}" #export PS1="%n %W %D{%T} %F{green}" export PYENV_ROOT="$HOME/.pyenv" #export PATH="$PYENV_ROOT/bin:/Users/masa/bin:$PATH" eval "$(pyenv init -)"
quickquip

2022/12/04 06:41

やってみたらいいんじゃないかと
guest

0

ベストアンサー

python-build: use zlib from xcode sdk
BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d)

checking for gcc... clang

問題点
clang/llvm がインストールされているようで、PATHの探索順でそちらの Cコンパイラを優先しています。

要確認 .zshrc 等で PATH が上書きされてないか。
zlib だけ from xcode sdk なので、xcode 環境で使えるかを確認。もしくは homebrew で install

pyenv コマンドをそのまま使いたい場合は
PATH の探索順を解消する必要がありますが、PATHの変更は他への影響もあるので、
環境変数 CC にビルド時に指定したいコンパイラのパスを指定することもできます。

CC=/path/to/gcc pyenv install version という形で、一時的に環境変数を設定

参考: Keg-only Homebrew packages are forcibly linked / added to PATH

these Homebrew packages are known to break Pyenv builds if added to PATH: binutils, llvm. coreutils

https://stackoverflow.com/questions/71577626/issues-installing-python-3-8-10-on-macos-12-3-monterey

※ Apple Command Line Tools の中にバンドルされた gcc を探し、CCに設定すると良いようです。
brew で gcc をインストールする回答もありますが、
環境構築に慎重になるなら新規のインストールは避けた方がよいでしょう。
他への影響が発生する可能性があります。


pyenv のアンインストール

Error: No installed keg or cask with the name "pyenv"

参考: HomebrewでdoctorしたらWarning: You have unlinked kegs in your Cellarとなった時の対応方法

投稿2022/12/03 00:34

teamikl

総合スコア8664

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fuku-chann

2022/12/03 13:12 編集

ご回答大変ありがとうございます。 的確に教えていただき大変感謝いたします。 > zlib だけ from xcode sdk なので、xcode 環境で使えるかを確認。もしくは homebrew で install 下記の記事からzlibはxcodeでも使用できると思いますが、いかがでしょうか? https://sleepless-se.net/2019/08/05/pyenv-install-zlib-not-available-error/ >CC=/path/to/gcc pyenv install version という形で、一時的に環境変数を設定 上記設定方法をご教示いただけますでしょうか? zshrcファイルに追記しましたが、Cコンパイルエラーが消えません。。。 brew doctorにあるWarning: config...の解決策は下記でよろしいでしょうか? https://qiita.com/yutoman027/items/ae11bf22bdbcd645c92a
fuku-chann

2022/12/03 13:23 編集

エラーがありすぎてどこから手をつけたら良いか、、、環境は難しいですね。 明日も頑張ります。
teamikl

2022/12/04 05:47 編集

ビルドの話とpyenvの再インストールの話が混在してしまってますね。 取り急ぎ、見落としてる点の指摘を NG: CC=Library/Developer/CommandLineTools/usr/bin OK: CC=/Library/Developer/CommandLineTools/usr/bin/gcc 追記: 絶対パスにすることと、ディレクトリではなく実行ファイルを指定 実際に確認しましょう 追記2: 要確認、他のディレクトリだったり、gccにprefixなどはついてませんか /Library/Developer/CommandLineTools/usr/bin/gcc -v > brew doctorにあるWarning: config...の解決策は下記でよろしいでしょうか? brew doctor の結果に関しては該当しなかったようです。 > zshrcファイルに追記しましたが、Cコンパイルエラーが消えません。。。 ここは、zshrcを調べて、他のPATHが追加で設定されてないかどうかを調べてください。 懸念点を挙げておくと、pyenv を再インストールしても、PATH設定で他のコンパイラが優先されるようでは これまでと同様にビルドは失敗する可能性があります。 (※ CCを設定せずに pyenv コマンドを使えるようにPATH設定したい場合の話)
teamikl

2022/12/04 05:26

> 下記の記事からzlibはxcodeでも使用できると思いますが、いかがでしょうか? 実行ログでは checking whether the C compiler works... no の段階で躓いていて ここまでは到達してないので、ビルドしてみて結果を見る感じですね。 正しくコンパイラを指定できたうえで、次に起こるかもしれない依存ライブラリ関係の環境問題なので、 現時点では、同様のログ (zlib のみ xcode sdk) でそういった事例がある 程度の情報に留めておいてください。
fuku-chann

2022/12/04 09:14

ありがとうございます。 下記コードで試しましたが、進展ありませんでした。 12/04/22 11:05 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.8.0 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.0.tar.xz... -> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz Installing Python-3.8.0... python-build: use readline from homebrew python-build: use zlib from xcode sdk BUILD FAILED (OS X 12.3.1 using python-build 1.2.19-6-gbdfed51d) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204180429.33961 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204180429.33961.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221204180429.33961/Python-3.8.0': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop.
fuku-chann

2022/12/04 09:15

gccの絶対パスはこちらで間違いないようです。 /Library/Developer/CommandLineTools/usr/bin/gcc
fuku-chann

2022/12/04 09:17 編集

>追記2: 要確認、他のディレクトリだったり、gccにprefixなどはついてませんか gccにprefixがつくとどのようになりますでしょうか? すみませんが、例をご教示ください。
teamikl

2022/12/04 09:22

gcc のパスに関しては、事前に /Library/Developer/CommandLineTools/usr/bin/gcc -v で存在確認を忘れずに。 バージョンに関しては 3.8.x の最新版を試してください -> 3.8.15 その上でエラーが出るようなら、 さらに詳細なエラーログ (config.log) を確認して、ビルド時の個別の問題を見ていくことになります。
fuku-chann

2022/12/04 10:04

gccのパスを確認しましたので、結果を送付いたします。 12/04/22 18:04 /Users/mxxx /Library/Developer/CommandLineTools/usr/bin/gcc -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin21.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
fuku-chann

2022/12/04 10:08

pyenv install --listを実施すると、3.8.15がないので、not foundになってしまいます。 python-build: definition not found: 3.8.15 See all available versions with `pyenv install --list'. If the version you need is missing, try upgrading pyenv: cd /Users/masa/.pyenv/plugins/python-build/../.. && git pull && cd - listから3.8周辺のバージョンを抜粋したものです。 3.7.0 3.7-dev 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.8.0 3.8-dev 3.8.1 3.8.2 3.8.3 3.8.4 3.9.0b4 3.9-dev 3.10-dev
fuku-chann

2022/12/04 10:18

脇道にそれるかもしれないので恐縮ですが、下記の記事の解決法3の可能性は高くないでしょうか? 解決法3 xcode-betaのインストールと適用 最終的にこちらの Python 3.9.0、3.8.6を pyenv を使って macOS BigSur にインストールする を参考にして解決しました! 色々調べてみるとどうやらmacOSのバージョンが新しすぎてXcodeが対応していない(ここの理解は自信ないので間違っていればコメントで補足ください)ようなので、上の記事を参考にXcodeのベータ版を入れて対応する。 Beta Software Downloads よりXcode-betaのダウンロードをする。(要Apple ID) 1でダウンロードしたXcode-betaを開き、Prefarence->Locationsへ Command Line Tools を1でダウンロードしたバージョンに変更 https://qiita.com/taku-0728/items/64147574efd7a4a7807d
teamikl

2022/12/04 11:49 編集

リストにバージョンがなければ、pyenv のアップグレードを試してみてと言われてます 方法もログに提示されているとおりです If the version you need is missing, try upgrading pyenv: cd /Users/masa/.pyenv/plugins/python-build/../.. && git pull && cd - xcode のバージョンについてはまだ言及していませんでしたが、 リストに該当バージョンが出ないのは pyenv 環境の正常化が先なので、まだその前段階です。
fuku-chann

2022/12/04 11:59

承知いたしました。 pyenvのアップグレード試しましたが、time outになってしまいます。手順間違いないでしょうか? 12/04/22 20:53 /Users/masa/.pyenv/plugins/python-build git pull fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out 12/04/22 20:55 /Users/masa/.pyenv/plugins/python-build git pull && cd - fatal: unable to connect to github.com: github.com[0: 20.27.177.113]: errno=Operation timed out
teamikl

2022/12/05 04:19

git:// プロトコルで読みに行ってるのかな? python-build 内の .git/config ファイルの内容を確認してみてください。 もし該当するようなら https:// にするれば成功するはずです。 グローバルの設定例 git config --global url."https://".insteadOf git:// まずは最初に git が正常に働くかどうかを確認しましょう。 適当な https:// で始まる github 上のレポジトリを clone してみて 他のレポジトリでも同様のエラーがでる場合は、ネットワーク環境の問題かもしれません。 例: gitコマンドで github へ接続の確認 git clone https://github.com/pyenv/pyenv.git
fuku-chann

2022/12/05 06:30 編集

定期的にgitにpushしていて、問題なくアップデートされていますので、gitへの接続は問題ありません。 pushとは別にcloneも確認してみた方がよいでしょうか? (出先のため先にご意見をお伺いさせていただいております。)
teamikl

2022/12/05 07:07

git コマンドが機能していて、他でgithub.com への接続が問題なければ大丈夫そうです。
fuku-chann

2022/12/05 08:24 編集

git pull できましたーーー!!! ありがとうございます!!! git://になっていたということでしょうか?どういう状況なのでしょうか?(一昨日下記確認済みのため、可能性はないものと思っていました) 12/03/22 11:06 /Users/mxx/dxxx/axx-exx git remote -v origin https://github.com/fxx-cxx/axx-exx.git (fetch) origin https://github.com/fxx-cxx/axx-exx.git (push) 実施内容: 12/04/22 21:00 /Users/masa/.pyenv git config --global url."https://".insteadOf git:// 12/05/22 17:12 /Users/masa/.pyenv/plugins/python-build git pull
teamikl

2022/12/05 09:52 編集

git:// は github 側が今年廃止したようで、古い設定のリモートURL だとそれが残っていたのかもしれません。 config ~は git:// の代わりに https:// を使う設定です。グローバル(その環境での git) 全体で有効ですが 他で git:// を使っている等の稀なケースでない限り、通常の利用では支障ありません。 次に pyenv でのバージョンリストの確認、CCを設定してのビルドですね。
fuku-chann

2022/12/05 10:16

ありがとうございます。 pyenv install --version を実行したところ、色々バージョンが増えていました。 予定通り3.8.15でよろしいでしょうか? 3.8.10 3.8.11 3.8.12 3.8.13 3.8.14 3.8.15 3.9.0 3.9-dev 3.9.1 3.9.2 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.10.0 3.10-dev 3.10.1 3.10.2 3.10.3 3.10.4 3.10.5 3.10.6 3.10.7 3.10.8 3.11.0 3.11-dev 3.12.0a2 3.12-dev
teamikl

2022/12/05 10:42 編集

バージョン番号の major.minor.patch の末尾の数値は、 パッチやバグ修正なので、一番新しいものでよいです。 3.8.x 系列内での互換性は問題ありません。
fuku-chann

2022/12/05 10:37

3.12-devでしょうか?それとも3.11.0の方が良いでしょうか?
teamikl

2022/12/05 10:46

3.8系列という話だったので 3.8系列の最新 3.8.15 だけど、 安定板の一番新しいものなら 3.10.8 になります。外部ライブラリが対応しているかは要確認です。 https://www.python.org/downloads/release/python-3815/ Note: The release you're looking at is Python 3.8.15, a security bugfix release for the legacy 3.8 series. Python 3.10 is now the latest feature release series of Python 3. Get the latest release of 3.10.x here. 3.12-dev等 は先行して新しい機能を試したい人向けですね。 3.12.0のリリース時には仕様変更される可能性があります。
fuku-chann

2022/12/05 10:56

3.10.8 と3.8.15を試しましたが、インストールできませんでした。 12/05/22 19:51 /Users/mxxx CC=Library/Developer/CommandLineTools/usr/bin pyenv install 3.10.8 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.10.8.tar.xz... -> https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tar.xz Installing Python-3.10.8... python-build: use readline from homebrew BUILD FAILED (OS X 12.3.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195324.64052 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195324.64052.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... Library/Developer/CommandLineTools/usr/bin checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195324.64052/Python-3.10.8': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/05/22 19:53 /Users/mxxx python -V Python 3.6.0 12/05/22 19:53 /Users/mxxx CC=Library/Developer/CommandLineTools/usr/bin pyenv install 3.8.15 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.15.tar.xz... -> https://www.python.org/ftp/python/3.8.15/Python-3.8.15.tar.xz Installing Python-3.8.15... python-build: use readline from homebrew BUILD FAILED (OS X 12.3.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195419.65268 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195419.65268.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... Library/Developer/CommandLineTools/usr/bin checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205195419.65268/Python-3.8.15': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/05/22 19:54 /Users/mxxx python -V Python 3.6.0
teamikl

2022/12/05 11:05

12/05/22 19:53 /Users/mxxx CC=Library/Developer/CommandLineTools/usr/bin pyenv install 3.8.15 checking for gcc... Library/Developer/CommandLineTools/usr/bin から、CCの設定が正しくありません。
teamikl

2022/12/05 11:15

CommandLineTools の確認は、必要になるかもしれないけど、順序的にはまだです。 CCの設定がきちんとできて checking whether the C compiler works... no のところが yes になっても 他のエラーが出るようなら確認しましょう。 その場合は、See `config.log' for more details とあるので、 エラーログのファイルから更に詳細を調べることになります。
fuku-chann

2022/12/05 11:19

commandLineToolsにあるgccのパスは間違いないと思います。 下記コピペしたものです。 /Library/Developer/CommandLineTools/usr/bin/gcc
teamikl

2022/12/05 11:27 編集

実際に実行したコマンドが間違ってます。 ログではどちらも Library/Developer/CommandLineTools/usr/bin になってるので 正しいgccのパスで試しましょう。
fuku-chann

2022/12/05 11:32

これでもダメでした。 12/05/22 20:25 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.10.8 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.10.8.tar.xz... -> https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tar.xz Installing Python-3.10.8... python-build: use readline from homebrew BUILD FAILED (OS X 12.3.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205202745.69518 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205202745.69518.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221205202745.69518/Python-3.10.8': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/05/22 20:27 /Users/mxxx python -V Python 3.6.0
teamikl

2022/12/05 12:07

ここでようやく CommandLineTools の確認 https://qiita.com/taku-0728/items/64147574efd7a4a7807d 解決策2 を試してダメなら3へ https://qiita.com/craymaru/items/58e92fac99b5b0ec778f 解決策2 の xcode のアップデートを試した後、 確認のため 3.8.15 のインストールも試してみてください。 調べていたのが 3.8.x のため、3.10.x 特有の問題がある場合は分かりません。 尚、上記url で確認が取れるバージョンは BigSur で python 3.9.0 と 3.8.6 です。
fuku-chann

2022/12/05 17:52

解決策2で下記が表示されました。 12/05/22 20:35 /Users/mxxx xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates 12/06/22 2:50 /Users/mxxx softwareupdate --list Software Update Tool Finding available software Software Update found the following new or updated software: * Label: macOS Monterey 12.6.1-21G217 Title: macOS Monterey 12.6.1, Version: 12.6.1, Size: 2547683K, Recommended: YES, Action: restart, * Label: macOS Ventura 13.0.1-22A400 Title: macOS Ventura 13.0.1, Version: 13.0.1, Size: 3992861K, Recommended: YES, Action: restart,
fuku-chann

2022/12/05 17:56

まだかもしれませんが、インストールもできませんでした。 12/06/22 2:53 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.10.8 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.10.8.tar.xz... -> https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tar.xz Installing Python-3.10.8... python-build: use readline from homebrew BUILD FAILED (OS X 12.3.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025521.89189 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025521.89189.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025521.89189/Python-3.10.8': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/06/22 2:52 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.8.15 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.15.tar.xz... -> https://www.python.org/ftp/python/3.8.15/Python-3.8.15.tar.xz Installing Python-3.8.15... python-build: use readline from homebrew BUILD FAILED (OS X 12.3.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025314.87954 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025314.87954.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025314.87954/Python-3.8.15': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/06/22 2:55 /Users/mxxx python -V Python 3.6.0
teamikl

2022/12/06 02:30

次に解決策3を試されるということかな? より詳細なエラーが合ったほうが原因を特定しやすいので、 エラーログファイル (config.log?)の末尾20行程を載せられますか。全部は行数的に無理だと思うので。 configure: error: C compiler cannot create executables See `config.log' for more details 他に確認したい項目は、.zshrc でコンパイラに渡すオプションの環境変数を上書きしていないかどうか。 CC の他に、PATH, CFLAGS, LDFLAGS 辺りの環境変数。
teamikl

2022/12/06 02:38

今気が付いたけど、解決策2 のアップデートができてませんね。 URLの記事は --list で最新のアップデートが無いことを確認して、実際のアップデートを行っていませんが、 今回提示されたログではアップデートがあるという結果が表示されてます。 アップデート方法 softwareupdate --all --install --force もしアップデートができなかった場合は、再インストール sudo rm -rf /Library/Developer/CommandLineTools sudo xcode-select --install 参考: https://stackoverflow.com/questions/65778888/pyenv-configure-error-c-compiler-cannot-create-executables
teamikl

2022/12/06 03:19

./configure を実行したディレクトリに生成されますというのは、 pyenv が内部で呼び出している部分なので解りにくいですが。 ログの error in ~ の場所にあるはずです。 configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221206025314.87954/Python-3.8.15': configure: error: C compiler cannot create executables See `config.log' for more details 一時ディレクトリが使われているので install せずに確認する方法は echo $TMPDIR $TMPDIR 以下の build 時のタイムスタンプ / Pythonのバージョン / config.log
fuku-chann

2022/12/06 10:40

遅くなりましたが、ようやくアップデートが完了しました。 この後に、3.8.5および3.10.8をインストールしましたが、同様のエラーが継続しています。 12/06/22 19:28 /Users/mxxx softwareupdate --list Software Update Tool Finding available software No new software available. 12/06/22 19:34 /Users/mxxx python -V Python 3.6.0
fuku-chann

2022/12/06 11:16 編集

ログは下記lsof...実行でよろしいでしょうか? lsof /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/ python-build.20221206193438.3171/Python-3.8.5/config.log 12/06/22 19:40 /Users/mxxx echo $TMPDIR python-build.20221206193438.3171/Python-3.8.5/config.log /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/ python-build.20221206193438.3171/Python-3.8.5/config.log https://qiita.com/hypermkt/items/905139168b0bc5c28ef2
teamikl

2022/12/06 12:14

いいえ。config.log ファイルの内容です。
fuku-chann

2022/12/06 15:56

すみません、ファイルの内容はどうやって出すのでしょうか?(無知で本当にすみません)
fuku-chann

2022/12/06 22:52

下記はどこか間違っておりますでしょうか? 12/06/22 19:40 /Users/mxxx echo $TMPDIR python-build.20221206193438.3171/Python-3.8.5/config.log >一時ディレクトリが使われているので >install せずに確認する方法は echo $TMPDIR >$TMPDIR 以下の build 時のタイムスタンプ / Pythonのバージョン / config.log
teamikl

2022/12/07 04:13

echo $TMPDIR では、 その環境で使われる一時ディレクトリの場所のパスが表示されます。 ビルドはその下で行われるので、その下の 「build 時のタイムスタンプが付いたディレクトリ」 「Pythonのバージョンが付いたディレクトリ」 と2階層辿った先に config.log があるはずです。 install 時のログでは最後の方に長いパスが表示されているはず。 (パスはビルドのたびに毎回変わります) > この後に、3.8.5および3.10.8をインストールしましたが、同様のエラーが継続しています。 前回と同じということで省略されましたが、 実行時のコマンド CC=~ pyenv 3.8.15 の情報は必要です。 「3.8.5」はコメントでの記載ミスかもしれませんが、実際にタイプミスがあった場合 第三者からは知る術がないので、必ずコピー&ペーストで 客観的にも確認できる情報を提示しましょう。
fuku-chann

2022/12/07 07:51

申し訳ございません。 間違えて3.8.5になっておりましたので、再送いたします。 12/06/22 19:43 /Users/mxxx python -V Python 3.6.0 12/07/22 16:47 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.8.15 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.15.tar.xz... -> https://www.python.org/ftp/python/3.8.15/Python-3.8.15.tar.xz Installing Python-3.8.15... python-build: use readline from homebrew BUILD FAILED (OS X 13.0.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164802.26277 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164802.26277.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164802.26277/Python-3.8.15': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/07/22 16:48 /Users/mxxx python -V Python 3.6.0 12/07/22 16:48 /Users/mxxx CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.10.8 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.10.8.tar.xz... -> https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tar.xz Installing Python-3.10.8... python-build: use readline from homebrew BUILD FAILED (OS X 13.0.1 using python-build 2.3.7-2-g58bbbf88) Inspect or clean up the working tree at /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164825.27520 Results logged to /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164825.27520.log Last 10 log lines: checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "darwin" checking for gcc... /Library/Developer/CommandLineTools/usr/bin/gcc checking whether the C compiler works... no configure: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164825.27520/Python-3.10.8': configure: error: C compiler cannot create executables See `config.log' for more details make: *** No targets specified and no makefile found. Stop. 12/07/22 16:48 /Users/mxxx python -V Python 3.6.0
fuku-chann

2022/12/07 07:55

config.log ファイルの内容につきましては、理解が及ばず大変恐縮ですが、下記のようなことでは無いでしょうか? 内容はどうやって見るのでしょうか? 12/07/22 16:52 /Users/mxxx echo $TMPDIR python-build.20221207164802.26277/Python-3.8.15/config.log /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/ python-build.20221207164802.26277/Python-3.8.15/config.log 12/07/22 16:53 /Users/mxxx echo $TMPDIRpython-build.20221207164802.26277/Python-3.8.15/config.log -build.20221207164802.26277/Python-3.8.15/config.log
teamikl

2022/12/07 08:14

> 内容はどうやって見るのでしょうか? なんか認識に齟齬がありそう。場所の特定は出来ていてファイルの開き方が解らないということですか? config.log は、テキストファイルです。テキストエディタで閲覧可能です。 コマンドで内容を見る方法を尋ねられてるのでしたら、cat や末尾を表示する tail があります。
fuku-chann

2022/12/08 02:45 編集

時間がかかり申し訳ございません。ターミナルにopen/varを入力してようやくconfig.logのフォルダが見つかりました。うまく隠されていたため、テキストエディタから閲覧する方法が分かりませんでした。(繰り返し同じ質問をしてしまい申し訳ありませんでした) 下記2件のconfig.logの内容を送付いたします。 /var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/ python-build.20221207164802.26277/Python-3.8.15/config.logの末尾20行ほどの内容です↓ localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/Users/masa/.pyenv/versions/3.8.15' program_transform_name='s,x,x,' psdir='${docdir}' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define _GNU_SOURCE 1 #define _NETBSD_SOURCE 1 #define __BSD_VISIBLE 1 #define _DARWIN_C_SOURCE 1 #define _PYTHONFRAMEWORK "" configure: exit 77 var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164825.27520Python-3.10.8/config.の末尾20行ほどの内容です↓ localedir='${datarootdir}/locale' localstatedir='${prefix}/var' mandir='${datarootdir}/man' oldincludedir='/usr/include' pdfdir='${docdir}' prefix='/Users/masa/.pyenv/versions/3.10.8' program_transform_name='s,x,x,' psdir='${docdir}' runstatedir='${localstatedir}/run' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## /* confdefs.h */ #define _GNU_SOURCE 1 #define _NETBSD_SOURCE 1 #define __BSD_VISIBLE 1 #define _DARWIN_C_SOURCE 1 #define _PYTHONFRAMEWORK "" configure: exit 77
teamikl

2022/12/08 14:50

残念ながらエラーログの範囲外なので、エラーはもう少しファイル内容の上の方かな 予想だとアーキテクチャ関連のエラーかなと思ったけど、 まだまだ情報が足りない状態です。 configure の挙動について簡単に解説すると pyenv では、必要な python のバージョンをダウンロードして 自分の環境内でビルド (コンパイルやライブラリのリンク等) を行います。 Python は autoconf/automake というビルド時の手順を自動化するツールを使っているのですが、 この時用いられる configure では、各環境に応じたビルド時の設定ファイルを生成します。 checking whether the C compiler works... no という、Cコンパイラーが使えるかどうかのチェックで躓いているので、 コンパイラの PATH は合ってるはず&アップデート済ということならば、 他のコンパイル時のオプション等が次に確認したい項目です。 config.log 内のエラー個所の探し方は、以下を参考に https://breakthru.hatenablog.com/entry/2021/04/10/232318 エラーが出てると思われる個所を探してみてください。 コメントにあった参考サイトの解決策2 のコマンドラインツールのアップデートまでは確認出来たので、 次は、解決策3に進むことになります。 おそらく、pyenv のインストール経路によって、 対応しているPythonのバージョンが異なったり アーキテクチャの選択設定が必要になったりするのですが、 ここの具体的な部分を調べるためにエラーログが必要です。
fuku-chann

2022/12/08 18:31

該当と思われるconfig.logの内容を追加で送付いたします。 現在このページの過去のコメントを閲覧するためのボタンがなぜか表示されなくなってしまっておりますが、現在前回送っていただいた資料の手順2を実施中で、手順3がまだ実施できていなかったと思います。 まず、ログの状態をご確認いただいてから手順3に移ると記憶しておりました。 過去のコメントを閲覧する方法はありますでしょうか?他のデバイスで見ても変わらなかったのですが、何かのバグなのでしょうか? お手数ですが、前回ご紹介いたいたページ(確かx-code関連の記事だったように思います) python-build.20221207164802.26277/Python-3.8.15/config.logの内容です。 ## ----------- ## ## Core tests. ## ## ----------- ## configure:2812: checking build system type configure:2826: result: x86_64-apple-darwin22.1.0 configure:2846: checking host system type configure:2859: result: x86_64-apple-darwin22.1.0 configure:2889: checking for python3.8 configure:2919: result: no configure:2889: checking for python3 configure:2905: found /Users/masa/.pyenv/shims/python3 configure:2916: result: python3 configure:3010: checking for --enable-universalsdk configure:3057: result: no configure:3081: checking for --with-universal-archs configure:3096: result: no configure:3252: checking MACHDEP configure:3303: result: "darwin" configure:3597: checking for gcc configure:3624: result: /Library/Developer/CommandLineTools/usr/bin/gcc configure:3853: checking for C compiler version configure:3862: /Library/Developer/CommandLineTools/usr/bin/gcc --version >&5 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 configure:3873: $? = 0 configure:3862: /Library/Developer/CommandLineTools/usr/bin/gcc -v >&5 Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin configure:3873: $? = 0 configure:3862: /Library/Developer/CommandLineTools/usr/bin/gcc -V >&5 clang: error: unsupported option '-V -Wno-framework-include-private-from-public' clang: error: no input files configure:3873: $? = 1 configure:3862: /Library/Developer/CommandLineTools/usr/bin/gcc -qversion >&5 clang: error: unknown argument '-qversion', did you mean '--version'? clang: error: no input files configure:3873: $? = 1 configure:3893: checking whether the C compiler works configure:3915: /Library/Developer/CommandLineTools/usr/bin/gcc -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/masa/.pyenv/versions/3.8.15/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/masa/.pyenv/versions/3.8.15/lib conftest.c >&5 clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=13.0' configure:3919: $? = 1 configure:3957: result: no configure: failed program was: | /* confdefs.h */ | #define _GNU_SOURCE 1 | #define _NETBSD_SOURCE 1 | #define __BSD_VISIBLE 1 | #define _DARWIN_C_SOURCE 1 | #define _PYTHONFRAMEWORK "" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3962: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164802.26277/Python-3.8.15': configure:3964: error: C compiler cannot create executables See `config.log' for more details python-build.20221207164825.27520/Python-3.10.8/config.logの内容です。 ## ----------- ## ## Core tests. ## ## ----------- ## configure:2888: checking build system type configure:2902: result: i386-apple-darwin22.1.0 configure:2922: checking host system type configure:2935: result: i386-apple-darwin22.1.0 configure:2965: checking for python3.10 configure:2995: result: no configure:2965: checking for python3 configure:2981: found /Users/masa/.pyenv/shims/python3 configure:2992: result: python3 configure:3086: checking for --enable-universalsdk configure:3133: result: no configure:3157: checking for --with-universal-archs configure:3172: result: no configure:3328: checking MACHDEP configure:3379: result: "darwin" configure:3663: checking for gcc configure:3690: result: /Library/Developer/CommandLineTools/usr/bin/gcc configure:3919: checking for C compiler version configure:3928: /Library/Developer/CommandLineTools/usr/bin/gcc --version >&5 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 configure:3939: $? = 0 configure:3928: /Library/Developer/CommandLineTools/usr/bin/gcc -v >&5 Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin configure:3939: $? = 0 configure:3928: /Library/Developer/CommandLineTools/usr/bin/gcc -V >&5 clang: error: unsupported option '-V -Wno-framework-include-private-from-public' clang: error: no input files configure:3939: $? = 1 configure:3928: /Library/Developer/CommandLineTools/usr/bin/gcc -qversion >&5 clang: error: unknown argument '-qversion', did you mean '--version'? clang: error: no input files configure:3939: $? = 1 configure:3959: checking whether the C compiler works configure:3981: /Library/Developer/CommandLineTools/usr/bin/gcc -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/masa/.pyenv/versions/3.10.8/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/masa/.pyenv/versions/3.10.8/lib conftest.c >&5 clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=13.0' configure:3985: $? = 1 configure:4023: result: no configure: failed program was: | /* confdefs.h */ | #define _GNU_SOURCE 1 | #define _NETBSD_SOURCE 1 | #define __BSD_VISIBLE 1 | #define _DARWIN_C_SOURCE 1 | #define _PYTHONFRAMEWORK "" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:4028: error: in `/var/folders/nb/1sq4przx0918q4rzkxnn4mq40000gn/T/python-build.20221207164825.27520/Python-3.10.8': configure:4030: error: C compiler cannot create executables See `config.log' for more details
fuku-chann

2022/12/09 06:20

回答へのコメントが見れるようになりましたので、通常通りこちらにお願いいたしますm(_ _)m
teamikl

2022/12/09 08:50

> /Library/Developer/CommandLineTools/usr/bin/gcc --version > Apple clang version 11.0.0 (clang-1100.0.33.8) バージョンが以前の11.0のままですね。 コマンドラインツールのアップデート後のバージョンが正常に反映できてないのではないかな? 複数バージョンあり他の場所にインストールされてます。手順3 の Step1 でバージョン選択 エラー内容は、コンパイラーに与えているオプションが適応しないものなので、 手順3 の Step2 LDFLAGS という環境変数の設定で、コンパイル時のオプションの修正を行っています。 記事の内容に加え、今回のケースでは環境変数 CC も同時に変更が必要な点に注意。 ここまでやっても対象のPythonのバージョンによっては、対応していない場合もあるので ひとまずどちらのバージョンをインストールしたいかを決めたほうが良いと思います (情報が混在してしまう)両方対応したい場合は、より複雑になってきそうなので。 参考: amd64/x86_64環境を切り替えて使う https://devblog.pirika.org/entry/2022/01/24/113000
fuku-chann

2022/12/09 11:53 編集

ありがとうございます。 betaと記載があるインストーラーが見当たらなかったのですが、Xcode 14.1をインストールしました。 下記1~3は実施済みです。 1. Beta Software Downloads よりXcode-betaのダウンロードをする。(要Apple ID) 2. 1でダウンロードしたXcode-betaを開き、Prefarence->Locationsへ 3. Command Line Tools を1でダウンロードしたバージョンに変更 バージョンは特に違いがわからないので、希望はございませんが、どちらでもよければ新しい3.10.8の方が良いと思います。 その場合は、下記を実施でよろしいでしょうか? $ LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib" pyenv install 3.10.8
teamikl

2022/12/09 16:30

> 記事の内容に加え、今回のケースでは環境変数 CC も同時に変更が必要な点に注意。 先にも書きましたが、環境変数CCの設定も必要です。 予め環境変数に設定しておけば1行で書かなくても大丈夫です。 > どちらでもよければ新しい3.10.8の方が良いと思います。 ここが環境依存なのでどちらでもよくなくて、 インストールされてる pyenv/homebrew に依存します。 詳しくは一つ上の参考リンクを参照してください。 ちなみに確認ですが、pyenv の利用は前提条件で必須ですか? 他の方法でインストール等の手段もありますが。→公式インストーラーや brew 現状の pyenv 環境構築は、パッチ等を自分で判断して当てられないと難しい気がします。 他に確認項目としては、他で使っているライブラリ等で バージョンが対応しているかどうかは確認しておいたほうが良いです。 新しめのバージョンだと対応していないことがあります。(使っているライブラリ次第
fuku-chann

2022/12/09 20:51 編集

>ちなみに確認ですが、pyenv の利用は前提条件で必須ですか? 他の方法でインストール等の手段もありますが。→公式インストーラーや brew 現状の pyenv 環境構築は、パッチ等を自分で判断して当てられないと難しい気がします。 上記につきまして、ご質問させていただきます。(理解不足がありますが、申し訳ございませんm(_ _)m) はじめた当初は公式インストーラーで行ったこともありますが、バージョン変更が上手くいかなかったので、当時バージョンの変更が便利と言われていたpyenvを使用することになりました。互換性の関係でpyenvもバージョン変更が簡単ではないと思いますが、皆さんどうされているのでしょうか? 公式インストーラーでは、pythonのバージョン変更は簡単にできるのでしょうか? teamiklさんはどのようにバージョン変更を行っておりますでしょうか?
teamikl

2022/12/09 22:03

自動テストやサーバー用途であれば docker だったり、 開発版等を自分でビルドした場合は、別々の場所にインストールし 実行はPATHの通っている場所にバージョン番号で区別できる名前で、 シンボリックリンクを張ったりします。 例 /opt/Python-3.8.x/bin/python3.8 -> python38 /opt/Python-3.10.x/bin/python3.10 -> python310 homebrew でバージョンを指定してのインストールでも 複数バージョンをインストールするようなプログラムは、 バージョン番号のサフィックス付きの名前でコマンドが提供されたりします。 pyenv が使えればそれがベストだと思いますが、難しそうなら妥協案も探ったほうが良いかな 公式インストーラーでバージョン切り替えに対応しているのは、 windows 版のみです。
fuku-chann

2022/12/10 02:19 編集

>pyenv が使えればそれがベストだと思いますが、難しそうなら妥協案も探ったほうが良いかな 今後もmacを継続して使う予定のため、やはりpyenvで使用していきたいと考えております。 お手数ですが、本件可能な限りサポートいただけますと大変助かります。 どうかよろしくお願いいたします。 >他に確認項目としては、他で使っているライブラリ等で >バージョンが対応しているかどうかは確認しておいたほうが良いです。 >新しめのバージョンだと対応していないことがあります。(使っているライブラリ次第 gspread、json、seleniumなど使用しておりますが、pythonバージョンとライブラリの互換性はどのように確認するのが確実になりますでしょうか? > >記事の内容に加え、今回のケースでは環境変数 CC も同時に変更が必要な点に注意。 >先にも書きましたが、環境変数CCの設定も必要です。 互換性を確認してからになりますが、3.8.15をインストールする場合、下記のようになりますでしょうか? $ LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib" CC=/Library/Developer/CommandLineTools/usr/bin/gcc pyenv install 3.8.15 pyenv install >予め環境変数に設定しておけば1行で書かなくても大丈夫です。 上記が理解できず間違っている可能性があると思い、先にご確認させていただいております。
teamikl

2022/12/10 07:45 編集

申し訳ないけど、単発の質問・回答の範疇を超えてると思うので、 そこまでのサポートは請け負えません。 >上記が理解できず間違っている可能性があると思い、先にご確認させていただいております。 理解が伴わないまま、いろいろとコマンドを試すのは危険です まずはお使いのシェルの環境変数の設定方法を調べてください。 そのうえで、環境変数 CC と LDFLAGS にそれぞれの値を設定して pyenv のコマンドを実行します。 環境変数が正しく設定されていれば、 ログに該当する行が見当たるはずなので、 環境変数の設定が有効かどうかを確かめられます。 $(xcrun --show-sdk-path)の部分は、実行時に値が展開されるので、 先に xcrun --show-sdk-path の内容を調べておきましょう。 ここで設定する環境変数は、 pyenv install 実行時の 内部の configure が実行されるときに C コンパイラに関するオプション設定です。 現状の躓いている原因は、Cコンパイラが正しくないオプションで実行されている為 正しい ちなみに、ここはまだ準備段階です。 実際にコンパイラの設定が正常になって、初めて 今度はコンパイル時のエラーを確認して、その対処方法を調べるといった流れになります。 内容の理解が伴ってないと ほぼ、環境情報が少ないまま目隠しで指示だけをだす、みたいな状態になってるので たぶんこのペースでのやり取りはいつまでかかるかわからない、 私もずっと毎日ログインできるわけではないので、目処の立たないことを約束まではできません。 最後に、解決策の方針のみ選択肢を示しておくと、まだ試してないことも含めて - 現状からの修正ではなく、homebrew と pyenvのインストールから構築  上記リンクを参照 - CommandLineTools ではなく、brew でインストールした gcc を使う - 妥協案でpyenv 外でインストールして、切り替えだけ pyenv を使う 詳細が必要であれば、別途質問を立てるなどを検討してください。 ---- ライブラリのバージョン確認に関しては、 ここは一時的な作業なので、pyenv 外でインストールして試してもよいと思います。
fuku-chann

2022/12/10 13:01

わかりました。 もう少し勉強してから再度質問させていただきます。 長い間お付き合いいただき誠にありがとうございました。
guest

0

「pyenv install --list」は、インストールしてあるリストではなく、インストール可能なバージョンのリストです。
インストール済みのバージョンのリストは「pyenv versions」で確認できます。

インストールするには、「pyenv install <インストールしたいバージョン>」とします。

投稿2022/12/02 09:12

TakaiY

総合スコア12657

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

fuku-chann

2022/12/02 09:43

ご回答ありがとうございます。 pyenv install の結果を追記しましたが、インストールされませんでした。 どこを確認したら良いでしょうか?
TakaiY

2022/12/02 09:53

エラーを見ると、Cのコンパイルができないのが原因みたいですね。 僕は、Mac使いではないので、深くはわかりませんが、 「pyenv 'C compiler works... no' 'OS X 12.3.1'」 で検索すると、同様の問題に合っている人の記事がいくつかみつかります。参考にすると解決するかもしれません。 https://cocoinit23.com/pyenv-configure-error-c-compiler-cannot-create-executables/ https://qiita.com/taku-0728/items/64147574efd7a4a7807d
fuku-chann

2022/12/02 10:43

質問欄に追記しましたが、pyenvのアンインストールができませんでした。 かなり重症のようです。。。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問