LoginSignup
1
0

More than 3 years have passed since last update.

MacOS11(Big Sur)にアップデートしたら、pyenv環境でlzmaのエラーとpyenv installのエラーが発生した

Posted at

環境

  • Mac OS 11.0.1
  • pyenvでインストールしたPython 3.8.4
  • pyenv 1.2.22

背景と対処

以前までのMacOS10(Catalina)で動いてはずのpyenv環境がMacOS11(Big Sur)にしたら
エラーが発生して動かなくなってしまった。
エラーの内容は以下の通り。

Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.

ふむふむ。
なんか知らんが、lzmaが入ってないから怒られていそうだ。
調べて入れたらいけるやろ!
参考記事:Mac|Pythonのエラーの解決方法|Could not import the lzma module
やはり先人がいましたね。感謝感謝!

$ brew install xz
$ pyenv uninstall 3.8.4
$ pyenv install 3.8.4

とりあえず、xz入れて(Macではこれらしい)、pyenvのPython3.8.4をuninstallして、またPython3.8.4を入れるっと・・・
あれ???
pyenvにPython3.8.4が入らない・・・
エラー内容がこちら。

$ pyenv install 3.8.4
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.4.tar.xz...
-> https://www.python.org/ftp/python/3.8.4/Python-3.8.4.tar.xz
Installing Python-3.8.4...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

...
./Modules/posixmodule.c:8433:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.

...なんでや。
またしても、調べるか、、、
参考記事:pyenv installでエラーが出た話(叙事的な話で、結局クリティカルな原因は不明)
こちらも同じようなエラーが起きている。
とりま試してみよう。

$ brew doctor

...

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

なんかWarningのエラーが出たな。
解消するしかない...
参考記事:brew doctor で警告が出た!warningとの奮闘記
書いてあるやつ、打ってみるか

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

お、なんかやたら時間かかったけどWarningエラーは消えたな

いざ!

 $ pyenv install 3.8.4

おお!!やっとpyenvに3.8.4が入った!!

感想

なんかlzma入れるだけだと思ったら色々エラーでハマってしまった。
なんとか無事に解決できてよかった。

1
0
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
0